Left 4 Dead 2 Multiplayer Server Installation
Updated by Linode Contributed by Andrew Gottschling
Dedicated CPU instances are available!Linode's Dedicated CPU instances are ideal for CPU-intensive workloads like those discussed in this guide. To learn more about Dedicated CPU, read our blog post. To upgrade an existing Linode to a Dedicated CPU instance, review the Resizing a Linode guide.
Left 4 Dead 2 is a single-player game developed and published by Valve Inc. Besides its fantastic single-player mode, Left 4 Dead 2 also offers a great multiplayer mode so you can blast zombies with your friends. This guide will explain how to prepare your Linode, install SteamCMD, and then install and configure Left 4 Dead 2 on Debian or Ubuntu.
Before You Begin
You will need the following items to get started:
- A Steam account.
- OPTIONAL (needed to test the server): A copy of Left 4 Dead 2.
- A Linode with at least 2GB of RAM and 10GB of free disk space.
- An up-to-date Linode running Ubuntu or Debian. We suggest you follow our Getting Started guide for help configuring your Linode.
NoteThis guide is written for a non-root user. Commands that require elevated privileges are prefixed withsudo
. If you’re not familiar with the sudo command, reference the Users and Groups guide.
Preparing your Linode
Left 4 Dead 2 is sold on Steam. Therefore, you will use SteamCMD to download and maintain the server for the game.
Because a current Linode runs on a 64-bit operating system, you need to download a few extra libraries in order to run SteamCMD.
Configure the package manager to include accommodations for i386 architecture:
sudo dpkg --add-architecture i386
Update the system:
sudo apt-get update && sudo apt-get upgrade
Install requisite 32-bit libraries:
sudo apt-get install lib32gcc1 lib32stdc++6 libc6-i386 libcurl4-gnutls-dev:i386 screen
Note
If you’re running a legacy Linode on a 32-bit kernel, install these packages instead:
sudo apt-get install libcurl4-gnutls-dev:i386 libc6-i386 libgcc1 screen
If you have a firewall running on your Linode, add exceptions for SteamCMD:
sudo iptables -A INPUT -p udp- m udp --sport 4380 --dport 1025:65355 -j ACCEPT sudo iptables -A INPUT -p udp -m udp --sport 10999 --dport 1025:65355 -j ACCEPT sudo iptables -A INPUT -p udp -m udp --sport 7777 --dport 1025:65355 -j ACCEPT sudo iptables -A INPUT -p udp -m udp --sport 27015 --dport 1025:65355 -j ACCEPT
Note
If you’ve configured your firewall according to our Securing Your Server guide, be sure to add these port ranges to your/etc/iptables.firewall.rules
file.
Install SteamCMD and Left 4 Dead 2
NoteThis guide requires additional libraries which are not included in our standard SteamCMD Guide. This guide includes standalone configuration instructions for SteamCMD. If you have already followed our SteamCMD installation guide, you can skip to step 4.
From your user’s home folder, download SteamCMD into its own directory:
mkdir Steam cd Steam wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
Extract the package and remove the archive file:
tar -xvzf steamcmd_linux.tar.gz rm steamcmd_linux.tar.gz
Run the SteamCMD installer:
./steamcmd.sh
This command will display output similar to this:
Redirecting stderr to '/home/steam/Steam/logs/stderr.txt' [ 0%] Checking for available updates... [----] Downloading update (0 of 7,013 KB)... [ 0%] Downloading update (1,300 of 7,013 KB)... [ 18%] Downloading update (3,412 of 7,013 KB)... [ 48%] Downloading update (5,131 of 7,013 KB)... [ 73%] Downloading update (6,397 of 7,013 KB)... [ 91%] Downloading update (7,013 of 7,013 KB)... [100%] Download complete. [----] Installing update... [----] Extracting package... [----] Extracting package... [----] Extracting package... [----] Installing update... [----] Installing update... [----] Installing update... [----] Cleaning up... [----] Update complete, launching Steam... Redirecting stderr to '/home/steam/Steam/logs/stderr.txt' [ 0%] Checking for available updates... [----] Verifying installation... Steam Console Client (c) Valve Corporation -- type 'quit' to exit -- Loading Steam API...OK. Steam>
The
Steam>
prompt is similar to the Linux command prompt - with the exception of not being able to execute normal Linux commands.Install Left 4 Dead 2 from the SteamCMD prompt:
login anonymous force_install_dir ./L4D2-server app_update 222860 validate
If the download looks like it has frozen, be patient. This can take some time. Once the download is complete, you should see this output:
Success! App '222860' fully installed. Steam>
Finally, exit SteamCMD:
quit
Configure Left 4 Dead 2
Before you configure the server, you should download an example config file:
cd ~/Steam/L4D2-server/left4dead2/cfg
Choose one of the following example files:
wget https://raw.githubusercontent.com/linode/docs-scripts/master/hosted_scripts/left-4-dead-2-multiplayer-server-installation/basic-server.cfg wget https://raw.githubusercontent.com/linode/docs-scripts/master/hosted_scripts/left-4-dead-2-multiplayer-server-installation/detailed-server.cfg
Make sure to rename the file to
server.cfg
before launching the server:Open the configuration file with
nano
to edit the configuration. Most server options are explained in the configuration file. Simply follow the instructions:nano server.cfg
When you are finished, exit
nano
and save your changes.Next, it is a good idea to write a custom startup script that will execute your custom config files.
- ~/Steam/L4D2-server/start_L4D2.sh
-
1
screen ./srcds_run -console -game left4dead2 +port 27020 +maxplayers 8 +exec server.cfg +map c2m1_highway
Note
The+port 27020
parameter is not required but is recommended so that your server always starts on the same port. The port number may be changed to whichever one you prefer, so long as it is not a privileged port.You can change the map to whichever one you prefer. This script, when run, will execute the L4D2 server in a Screen session.
Make the script executable:
chmod +x ~/Steam/L4D2-server/start_L4D2.sh
Use the Server
To start the server, simply input and run:
./start_L4D2
To detach from the screen session which runs the server console, press these two key combinations in succession:
CONTROL + A
CONTROL + DTo bring the console back, type the following command:
screen -r
To stop the server, bring back the console and type
exit
.
Entering The Server
You can connect to the server in any one of three easy methods:
Ensure that the developer console is enabled. On the main menu, press the tilde (
~
) key to open the console. Next, type the following:connect 12.34.56.78:27020
where 12.34.56.78 is your Linode’s ip, and 27020 is your port.A slightly easier method is to install the following add-on before launching the game: Link. After doing this, launch the game, click the new
Console
button on the main menu, and type the command found in method 1, above.A third method is to install the following add-on: Link and then launch the game. Next, click on the new
Server Browser
option on the main menu and find your server in the long list of servers. This method only works if you have set thehostname
,sv_search_key
, andsv_tags
options in the config file.Note
Your L4D2 server will only show up in theCustom
list of servers. Therefore, we recommend that you add it to your favorites to avoid having to look for it again.
Finally, invite friends to the game using the Steam Overlay (SHIFT + TAB
). Let the playing begin!
Join our Community
Find answers, ask questions, and help others.
This guide is published under a CC BY-ND 4.0 license.