The purpose of this guide is to create a private server that a community can be built round as the current matchmaking system deployed by Valve otherwise makes this impossible (as the lobby system will connect you to any public and available server out there).
Note: a dedicated server will be installed on either on a dedicated physical machine or in a virtual machine with dedicated resources, and should be configured with a static ip address [either in the networking configuration or via a DHCP assignment in your router]. I have my server running in a virtual machine …
The first thing that we need to do is download Ubuntu Server 8.1 [click on the tab for the Server edition and then select a download location to download the .iso file].
If you are installing a Virtual Machine boot from the .iso, press F4 on the first screen and select “Install a minimal virtual machine” – this will install version 8.1 of Ubuntu JeOS. Otherwise install a vanilla installation of Ubuntu Server on your box. The first two pages of this guide will show you step by step how to install Ubuntu Server (we will assume that the account for the Ubuntu installation is “l4d” and not administrator).
Note: For my virtual machine I set aside 10Gb of disk space – you may be able to get away with less, but as you can see Ubuntu JeOS and Left 4 Dead occupy almost 3 Gb on /dev/sda1:
Now that we have the preliminaries taken care of let’s update the installation:
sudo apt-get update
Upgrade the install:
sudo apt-get upgrade
Install SSH for remote management:
sudo apt-get install openssh-server
Install Wget so that we can download a necessary file:
sudo apt-get install wget
Create a directory for the Left 4 Dead installation and then cd into the new directory:
mkdir hldscd hlds
Download the hldsupdatetool:
Make the hldsupdatetool executable:
chmod +x hldsupdatetool.bin
Run the hldsupdatetool:
Type yes to the agreement and then click enter to continue.
Make Steam executable:
chmod +x steam
Run Steam to download the Left 4 Dead files:
./steam -command update -game l4d_full -dir /home/l4d/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/l4d/hlds/l4d\left4dead\ – this may take some time, so you may want to make a few cups of tea or something …
Once the download is complete we need to create a server configuration file [server.cfg] and a script to run the server with particular parameters.
Create a file called server.cfg and copy it [using SSH if necessary] to /home/l4d/hlds/l4d/left4dead/cfg.
Your server.cfg should look something like this:
hostname "Left 4 Dead"
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.
Now create a file called autoexec.cfg (in the same folder as server.cfg):
z_difficulty normal sets the default difficulty of the server to normal – you can set this to easy, normal, hard, or impossible.
Next we will create a script to run the game server as follows:
./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
Save the script as “startl4dserver.sh” and upload it to the home directory of the server.
-console: This will display a console that you can type commands into.
-game left4dead: This specifies that the server will run Left 4 Dead.
-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 WAN address.
+ip: where xx.xx.xx.xx is the static LAN address configured earlier.
-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 l4d_hospital01_apartment: 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/l4d/hlds/l4d/left4dead/maps
At this point you can run the server as follows:
To connect to the server from your (LAN) gaming machine you will need to enable the “Developer Console” in the game options as follows: At the main menu, select “Options”, then choose the “Keyboard/Mouse” selection. Enable the “Allow Developers Console” option.
You can then use the ~ key to bring up the console and then type:
Where xx.xx.xx.xx is the LAN ip address of the server.
To allow internet users to connect you will need to open ports 27000 to 27050 in your router firewall. I also forwarded 27015 directly to the server LAN address just for good measure.
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 command line. If this is the case you will simply be able to connect to your server from a LAN PC by connecting to you WAN address.