How to set up a l4d2 server on Linux

Specfically for Centos / RHEL but broadly applicable. You should have general familiarity with Linux before you attempt this.

  1. As your normal user create a screen – this is a virtual terminal your server will be running in, I strongly suggest you get familiar with screen
    screen
  2. In one of the screen windows, su to root
    su - root
  3. Create a user to run the server as & set a password, eg l4d2
    adduser l4d2
    passwd l4d2
  4. Su to that user
    su - l4d2
  5. Download hldsupdatetool.bin & run – this will create a steam executable

    wget http://www.steampowered.com/download/hldsupdatetool.bin
    chmod +x hldsupdatetool.bin
    ./hldsupdatetool.bin
  6. Download the L4D2 server – this will take time
    ./steam -command update -game left4dead2
  7. Create a basic config file
    vi left4dead2/cfg/server.cfg

    Example Contents:

    hostname "My Cool L4D2 Server" // Server Name
    rcon_password "changethis" //Set remote control password
    sv_lan 0 // Disable LAN
    mp_disable_autokick 1 // Disable Autokick
    sv_cheats 0 // Disallow Cheats
    sv_clearhinthistory 0 //Clear Server Side Hint History
    sv_consistency 1 //Enforce file consistency
    sv_pausable 0 //Server not pausable
    sv_allow_lobby_connect_only 0 // Disable Lobby Connections
    sv_voiceenable 1
    sv_alltalk 1
    sv_region 3 // set this to your region if required (3 = Europe)
    //sv_steamgroup 999  // set this if required
    z_difficulty hard
    sv_search_key "hohum"
    sv_gametypes "coop"
  8. Start the server (with your own IP address here)
    cd ~/left4dead2
    ./srcds_run -game left4dead2 +maxplayers 4 +ip 123.45.67.89
  9. To kill the server just hit ctrl-c. You can now disconnect or reconnect to the screen the server is running in.

Every so often you may need to update to the latest version of the server, just kill it & run line 6 again.

If your linux box is firewalled with iptables, you may need to open ports 27015 & 27005 tcp & udp, eg have lines like

-A RH-Firewall-1-INPUT -m udp -p udp --dport 27015 -j ACCEPT
-A RH-Firewall-1-INPUT -m udp -p udp --dport 27005 -j ACCEPT
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 27015 -j ACCEPT
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 27005 -j ACCEPT

in

/etc/sysconfig/iptables

& do a

service iptables restart

Popularity: 100% [?]

This entry was posted in Uncategorized and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to How to set up a l4d2 server on Linux

  1. TheSpectator says:

    If you have an problem, try “./steam -command update -game left4dead2 -dir .”

  2. l4d2fanboy says:

    For linux you should add “-autoupdate” to your start command so the server won’t go down every time steam updates. (this is a linux only command)

  3. hasser says:

    You don’t want to use sv_search_key unless it’s a private server. This disables all public lobbies.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>