Left 4 Dead: SourceMod – Linux Installation

Why would you want SourceMod on your Left 4 Dead server?

Well it can help you administer your server in game and you can also install additional plugins with it. This is what it looks like in game …

Installation consists of copying files to your server so you will need ftp or SSH access to your server. Before you do this you will need to confirm your Steam ID for use later – simply join a server and then open the console and then type the following and hit enter:

status

The result will give you your Steam ID. Copy and paste it from the console and save it for later.

Next download Metamod to your computer and extract the files. Copy the addons folder to your left4dead folder on your server. On my server this is /home/user/hlds/l4d/left4dead.

Now you need to generate a vdf file – choose Left4Dead as the game type and leave the gamefolder blank to download the correct file (click Generate Metamod VDF). Upload this file to the addons folder on your server. On my server this is /home/user/hlds/l4d/left4dead/addons.

Next download SourceMod and extract the files. Copy the contents of your addons folder to the addons folder on the server. On my server this is /home/user/hlds/l4d/left4dead/addons. Copy the contents of the cfg folder to the cfg folder on the server. On my server this is /home/sxl4d/user/l4d/left4dead/cfg.

Now we just need to grant ourselves some admin rights by editing the addons/sourcemod/configs/admins_simple.ini file. On my server this is /home/user/hlds/l4d/left4dead/addons/sourcemod/configs/admins_simple.ini.

At the bottom of the file just add the following line where the Steam ID is the one you saved earlier:

"Steam ID" "bcdefghijklmn"

The Steam ID specifies a player and the next field specifies permissions as per the following table:

Simply reboot the server and you are good to go – connect to your server, open the console and type the following to view the in-game admin menu:

sm_admin
Thanks to KingJulian on this thread for many of these details …

Left 4 Dead – Private Dedicated Ubuntu Server 8.1

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:

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

Make the hldsupdatetool executable:

chmod +x hldsupdatetool.bin

Run the hldsupdatetool:

./hlsupdatetool.bin

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"
rcon_password "myrconpassword"
sv_allow_lobby_connect_only 0
sv_password "mypassword"

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

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:

#!/bin/bash
cd /home/l4d/hlds/l4d
./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 
l4d_hospital01_apartment

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:

./startl4dserver.sh

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:

connect xx.xx.xx.xx

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.