Ubuntu 10.4 Lucid – Basic Left 4 Dead 2 Dedicated Server Setup

Setting up a dedicated server for Left 4 Dead 2 (L4D2) is almost exactly the same as Left 4 Dead (L4D) which I covered a while ago.

I knew that L4D2 would take up more space and so I started out with a 15Gb virtual hard drive this time. After installing a minimal virtual machine, open-vm-tools and L4D2 I had 4.6Gb of free space. Hopefully that will remain enough!

First update Ubuntu Server:

sudo apt-get update
sudo apt-get upgrade

If you do not have wget installed then install it as follows:

sudo apt-get install wget

Create a new folder for downloading and installing L4D2:

mkdir hlds

Download the hldsupdatetool from Valve:

wget http://www.steampowered.com/download/hldsupdatetool.bin

Make hldsupdatetool.bin executable:

chmod +x hldsupdatetool.bin

Run the hldsupdatetool:


Type yes to the agreement and then press enter to continue.

Now make Steam executable:

chmod +x steam

Run Steam to download the Left 4 Dead files:

./steam -command update -game left4dead2 -dir /home/username/hlds

Note: you will most likely be prompted to run the last command again as the first time it runs it will update steam and not install Left 4 Dead.

Left 4 Dead files will now install to /home/username/hlds/left4dead2/ – this may take some time, so you may want to make a cup of tea. Once Left 4 Dead 2 has installed we need to to create a server configuration file called server.cfg and a script to run the server.

Create files called server.cfg and autoexec.cfg in the following location /home/username/hlds/left4dead2/left4dead2/cfg:

cd /hlds/left4dead2/left4dead2/cfg
touch server.cfg
touch autoexec.cfg

A basic server.cfg should look something like this:

hostname "Left 4 Dead"
rcon_password "myrconpassword"
sv_allow_lobby_connect_only 0
sv_password "mypassword"
  • You can change the hostname to whatever you want.
  • The rcon_password is for remote administration of Left 4 Dead when the server is running.
  • sv_allow_lobby_connect_only 0 allows for players to connect directly to your server without using the Left 4 Dead lobby system.
  • sv_password sets a password for gamers to play on your server.

In autoexec.cfg we will set the default difficulty for the server to normal with the following line:

z_difficulty normal

Note: z_difficulty normal can be changed to easy, hard, or impossible.

Next create a script in your /home/username/ directory to run the game server:

touch startl4d2server.sh

The script is as follows:

cd /home/username/hlds/left4dead2
./srcds_run l4d -autoupdate -console -maxplayers 8 + sv_lan 0 +hostip
xx.xx.xx.xx +ip xx.xx.xx.xx +hostport 27015 +exec server.cfg +map
  • -console: This will display a console that you can type commands into.
  • -game left4dead2: This specifies that the server will run L4D2.
  • -maxplayers 8: This will specify the maximum number of players the server will allow, setting it to 8 should allow you to use versus mode, otherwise set it to 4 for survivors only gameplay.
  • -autoupdate: This will make the server check and update to the latest version when you launch it but this needs a manual fix to work properly.
  • +hostip: where xx.xx.xx.xx is your internet address.
  • +ip: where xx.xx.xx.xx is your Ubuntu server static IP address. .
  • -port 27015: This will specify the port for the server to run on – 27015 is the default port.
  • +sv_lan 0: This will force the server to run on the internet instead of just on a LAN.
  • +map c1m1_hotel: This will specify the map that the server will start with (and must be configured). You will find all the available map names on your server here: /home/username/hlds/left4dead2/left4dead2/maps

Make your startl4d2server script executable:

chmod +x startl4d2server.sh

At this point you can run the server as follows:


To connect to the server from your (LAN) PC you will need to enable the “Developer Console” in the game options as follows:

At the main menu select Options then Keyboard/Mouse followed by the Allow Developers Console option.

You can then use the ~ key to bring up the console and then type:

connect xx.xx.xx.xx

Note: xx.xx.xx.xx is the LAN IP address of the server.

To allow internet users to connect you will need to open port 27015 directly to the server LAN address. Friends connecting from the internet will then be able to connect to the WAN ip address of your server using the password that you provided them.

Note: if your router supports it you may be able to dispense with +ip and +hostip in your startl4d2server.sh script.

Left 4 Dead: The Sacrifice – DLC for L4D and L4D2

Valve will release new down-loadable content (DLC) called “The Sacrifice” for Left 4 Dead and Left 4 Dead 2 on October 5th. This DLC will be free for PC gamers!

“The Sacrifice” is a prequel to “The Passing” and includes the original Left 4 Dead survivors as they fight their way south. The Sacrifice campaign will be playable in Campaign, Versus, and Survival modes. There will also be a new finale where players have to decide who will sacrifice themselves so that the other survivors may live.

Left 4 Dead 2 players will get to play The Sacrifice with L4D2 Special Infected and weapons, as well as being able to play in Scavange mode. L4D2 players will also get the “No Mercy” campaign from L4D1 which, again, will be played with the L4d1 survivors.

The Sacrifice also boasts five new achievements.

Personally, I am really looking forward to playing “No Mercy” on L4D2!

Windows 7 x64: Running Steam In Windows Compatability Mode Is Not Recommended

All of a sudden today, I booted my Windows 7 machine and got the following message when Steam tried to run:

So I checked the properties for Steam.exe and found that compatability mode was off:

Thankfully fixing this problem was quite straight-forward though:

  • Click Start, type regedit and then press the Enter key
  • In the left hand pane of Regedit navigate to the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • In the right hand pane delete the string for Steam.exe

Once I had done this I was able to start Steam normally.

According to Edugeek there is a second registry key that you can try if there is not a Steam.exe entry in the one listed above:

  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

Thanks to Edugeek for the fix!

Left4Dead 2 – Server Is Enforcing Consistency For This File: left4dead2/pak02_dir.vpk

For some reason I just encountered this error in Left4Dead 2 – fortunately the fix was fairly straightforward – I just needed to install Left 4 Dead 2 Add-on Support.

Right click on the Steam icon in the system tray and click Library.

Now click on the Tools link.

Look for Left 4 Dead 2 Add-on Support in the list.

If it is not installed then simply Install it. If the install is incomplete, right click it, and then select Delete Local Content and then reinstall it.

Thanks to Goathief on the Steam forums for the fix.

Left 4 Dead – Steam Group Server Settings

Aside from setting a password with the sv_password cvar in your server.cfg there is another way to make your server private, and that is to associate it with a “steam group”.

The advantage of this method is that you can invite players to your steam group and only those players will be able to play on the server – they will also see steam group servers when the game loads (so your server should be easy to join).

So the first step is to create a steam group. Once this is created the group admin (the person who created the group) will need to click on Admin Options and then Edit group profile to get the steam group ID.

Once you have the steam group ID you can edit you server.cfg as follows, (where ###### is your steam group ID):

sv_allow_lobby_connect_only 0sv_steamgroup ######sv_steamgroup_exclusive 1

Then just invite your friends to the steam group and everyone should see your server listed in-game just like this: