Installing a Left 4 Dead 2 Multiplayer Server

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

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.
Note
This 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.

  1. Configure the package manager to include accommodations for i386 architecture:

    sudo dpkg --add-architecture i386
    
  2. Update the system:

    sudo apt-get update && sudo apt-get upgrade
    
  3. 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

  4. 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

Note
This 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.
  1. 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
    
  2. Extract the package and remove the archive file:

    tar -xvzf steamcmd_linux.tar.gz
    rm steamcmd_linux.tar.gz
    
  3. 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.

  4. 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>
    
  5. Finally, exit SteamCMD:

    quit
    

Configure Left 4 Dead 2

  1. 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:

  2. 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
    
  3. When you are finished, exit nano and save your changes.

  4. Next, it is a good idea to write a custom startup script that will execute your custom config files.

    File: ~/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.

  5. Make the script executable:

    chmod +x ~/Steam/L4D2-server/start_L4D2.sh
    

Use the Server

  1. To start the server, simply input and run:

    ./start_L4D2
    
  2. To detach from the screen session which runs the server console, press these two key combinations in succession:

    CONTROL + A
    CONTROL + D

  3. To bring the console back, type the following command:

    screen -r
    
  4. 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:

  1. 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.

  2. 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.

  3. 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 the hostname, sv_search_key, and sv_tags options in the config file.

    Note
    Your L4D2 server will only show up in the Custom 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!

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.