Custom-made, luxury planet building.
Instant Left 4 Dead 2 Server on CentOS 7

left 4 dead
2

Create a disposable dedicated Left 4 Dead 2 server with a few clicks.  Follow my directions to automatically generate a secured and updated CentOS 7 linux server in the linode cloud.  The best part? It will cost you $0.015/hr to run.

Solve the Left 4 Dead 2 Server Problem

I've never played Left 4 Dead. This weekend my partner wanted us to run from zomies. Great! I've heard this game is one of the best. But it's got some crap servers right now. No problem! What's more fun than playing games? Hacking on game servers, of course!

Below, I'll post a full breakdown of my linode stackscript creation soon. But for now, the important stuff. How you, or anyone, can start up a server with these tools.

Creating the server

  • Log in, or create your account with linode.com.
  • First, create a new linode using the lowest tier available. The specs on the cheapest option creates a speedy Left 4 Dead 2 server.
  • Then visit the dashboard for your new linode. Click the Deploy an Image link.
  • Choose the Deploying using StackScripts link.
  • Search the Community Scripts for 'Left4Dead' and you will find my script, as shown:

    Screen Shot 2016-09-06 at 12.08.47 AM
    copy
  • Server Configuration Parameters:
    You will be presented with a handful of configuration options for your server. Take a moment to address each option.

    • Non-Root Username:  You will be unable to directly log into this server as root.  If you ssh into your server, you will do so with this username.
    • Non-root Password: Create a password for your account.
    • SSH Key for Non-root User: Gets copied to ~/.ssh/authorized_keys If you don't know what that means, just leave it blank.
    • Firewall Whitelist IP: This server is going to block all incoming traffic except for game traffic.  Whitelist your IP address in case you want to use ssh.
    • Title: Specify the name for your server, as displayed in the server browser.
    • Keyword: Used for sv_search_key. Or just ignore this.
    • Server console password: This password will be required to issue special commands to the server from in game.
    • Email Address: Your E-mail Address.
    • Server Region:  You should set this accordingly based on which linode data center you chose to host this server.
      • 0: US East Coast
      • 1: US West Coast
      • 3: Europe
      • 4: Asia
      • 255: Server reachable worldwide
    • Steam Group ID:  Associate this server with a Steam community.
    • Steam Group Exclusive: The first player connecting to this server must be a member of the specified Steam community.
    • Game Types: Choose which game types this server will allow.
    • Rate Limit: Limit the framerate of the server. Default 0 unlocks the framerate, allowing server to use 100% of a cpu core.
    • Image: Forced to CentOS7
    • Depolyment Disk Size: Use all the storage you're alloted.
    • Swap Disk: Choose 512MB.
    • Root Password: Specify a root password.  You cannot ssh directly as root to this server.
  • Press the Deploy button.

  • Wait a moment for the filesystem to be created.

Boot server and wait 5 to 10 minutes

Press that big BOOT button to start your Left 4 Dead 2 server for the first time. Now have a coffee. Your server is going to run updates, lock itself down, and download the left4dead server from steam.

If you're curious or impatient (or both like me) you can watch the server build itself.   Choose the [Remote Access]{style="text-decoration: underline;"} tab from your linode dashboard.  Click on [Lish via Browser: Launch Lish Console ]{style="text-decoration: underline;"} in the Console Access section.

You'll see output like this:

  • Server Booting:
    Left 4 Dead 2
    Server
  • Server Updating:
    Left 4 Dead 2
    Server
  • Steam Server Installing
    Left 4 Dead 2
    Server
  • Left 4 Dead 2 server game files downloading
    Left 4 Dead 2
    Server
  • Server running and ready for players!
    Left 4 Dead 2
    Server

Play on your server

Connecting to servers in L4d2 is pretty bad. So bad that by modern standards, I'd consider it broken. There's many methods for connecting to your own l4d2 server. Here's three methods you can use to connect to this server:

Connect from a game lobby

  • In the options menu, enable the developers console, which is disabled by default.
  • From the game main menu, open the console with tilde (~).
  • Enter the command mm_dedicated_force_servers 123.345.567.789.
  • Obviously, replace the above IP address with the correct one for your Left 4 Dead 2 server. Your server's ip address is printed near the top of the remote access tab of your linode dashboard.
  • Choose the Play a game with friends option from the main menu.
  • Choose to create a lobby. From here you can specify game parameters, and invite friends to play.
  • For good measure, open the console again and enter the mm_dedicated_force_servers command again.
  • Select the Best available dedicated server option.
  • When you start a game, the game will start on your server.

Connect directly to your server

  • In the options menu, enable the developers console, which is disabled by default.
  • Press the tilde key (~) to access the console.
  • Enter the command: connect 123.345.567.789.
  • Obviously, replace the above IP address with the correct one for your Left 4 Dead 2 server. Your server's ip address is printed near the top of the remote access tab of your linode dashboard.
  • Once connected to the server, you can invite players from your steam friends list. The game will also begin to populate with other Left 4 Dead 2 players who press the 'connect me to a random game' button.
  • Once connected to the server, press escape and initiate a vote to change the campaign and difficulties you wish to play.
  • Have fun!

Connect as a steam community server

If you associate your server with a steam community, you could choose the lobby option to use a community server. I've read it can take up to 24hrs of uptime before your server will be available in this way. The steam master browser list for community servers seems to be updated infrequently. Since I only run the server for a few hours before destroying it, this has never worked for me.

Destroy your server

This awesome Left 4 Dead 2 dedicated server of yours is costing you a 1.5 cents per hour. When you're done playing, you want to stop paying, right? Shutting down the server doesn't stop the pennies ticking. You need to destroy your server absolutely. Log back into the linode dashboard. View your list of linodes, and choose the 'remove' button. Accept the confirmation, and the whole thing ascends to gameserver heaven for eternal rest.

Additional Resources:

Server Persistance:

This server is not designed to live a long life. This install is a great template for a long-term dedicated server, but an experienced steam-server admin would need to take steps to keep this server healthy for extended use. YMMV.

Further ease of deployment:

I'm lazy. I'm going to use this deployment many times. I don't want to fill in all the configuration prompts every time I click to deploy a server. This could cost me a few minutes of precious game time!

The solution?  Create your own private StackScript that will set the requested variables automatically.  You can use the following template in your linode account to avoid answering the same questions every time you want to play:

#!/bin/bash

export SS_LOCALUSERNAME="myusername"
export SS_LOCALUSERPASSWORD="mysecretpassword"
export SS_PUBKEY="MYSUPERLONGSSHPUBLICKEY"
export SS_WHITELISTIP="123.345.567.789"

export L4D2_HOSTNAME="My Descriptive Servername"
export L4D2_SEARCH_KEY="mysearchkey"
export L4D2_RCON_PASSWORD="secret"
export L4D2_SV_CONTACT="bigger@texas.com"
export L4D2_SV_REGION="255"
export L4D2_SV_STEAMGROUP="0"
export L4D2_SV_STEAMGROUP_EXCLUSIVE="0"
export L4D2_SV_GAMETYPES="coop,versus"
export L4D2_SM_CVAR_FPS_MAX="0"

source <ssinclude StackScriptID="39186">

Shameless Plug

I'm available to assist with your server admin needs for a modest fee. I'm bored, give me something to do!