Left 4 Dead 2 Multiplayer Server Installation
Updated by Linode Contributed by Andrew Gottschling
Dedicated CPU instances are available!
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 with
sudo. 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
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
NoteIf you’ve configured your firewall according to our Securing Your Server guide, be sure to add these port ranges to your
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:
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>
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:
Configure Left 4 Dead 2
Before you configure the server, you should download an example config file:
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.cfgbefore launching the server:
Open the configuration file with
nanoto edit the configuration. Most server options are explained in the configuration file. Simply follow the instructions:
When you are finished, exit
nanoand save your changes.
Next, it is a good idea to write a custom startup script that will execute your custom config files.
screen ./srcds_run -console -game left4dead2 +port 27020 +maxplayers 8 +exec server.cfg +map c2m1_highway
+port 27020parameter 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:
To detach from the screen session which runs the server console, press these two key combinations in succession:
CONTROL + A
CONTROL + D
To bring the console back, type the following command:
To stop the server, bring back the console and type
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 184.108.40.206:27020where 220.127.116.11 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
Consolebutton 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 Browseroption on the main menu and find your server in the long list of servers. This method only works if you have set the
sv_tagsoptions in the config file.
NoteYour L4D2 server will only show up in the
Customlist 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
This guide is published under a CC BY-ND 4.0 license.