Wednesday, March 27, 2013

Getting started with a left 4 dead 2 server on vps

I decided to setup a dedicated left 4 dead server on a vps. I chose virpus as my vps host because they allow unmanaged which is cheap, and because they allow you to host your vps in Kansas. I wanted it as close as possible for a hopefully lower ping.

At first I got an openvz instance, but it's performance was so helter skelter that I decided to switch to a xen instance. 

Here are the instructions on how to set up a left 4 dead dedicated server on a virpus vps:

1. When you signup with virpus you get an email for setup. It tells you your name and password and then to login to manage.virpus.com.

2. Once you are in, go to controls>general>reinstall.

3. Pick Ubuntu 10.04 32 bit and install it. The install process takes around 10 minutes.

4. Go back to manage.virpus.com and then go to Controls>Root Password. Set a new root password.

4. After setting a new root password go to Controls>General>Reboot and reboot.

5. Now you can ssh into your server. Open terminal app(in OSX, if you are on windows use putty, if on linux it has its own terminal app) and type 'ssh root@yourserverip'

You will have to enter the password that you set in step 4.

After that type in these commands. 

cd /
mkdir left4dead2
cd left4dead2
 apt-get install wget
     Then finish the install process for wget

wget http://www.steampowered.com/download/hldsupdatetool.bin
cd ..
chmod 777 left4dead2
cd left4dead2
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin

sudo apt-get update
sudo apt-get upgrade
chmod 777 steam
./steam -command update -game left4dead2 -dir .
         This command will take about 10 minutes to complete

./steam -command update -game left4dead2 -dir .
          Yes you do need to do this command twice, if it says the same thing, then run it again.

After it installs you can chmod the steam and hldsupdatetool back to 755 or lower.
To launch the server:

cd /
cd /left4dead2/left4dead2
./srcds_run -game left4dead2 -ip yourserveriphere


This should get you up and running. Administering a l4d2 server is a much broader topic, so I will leave that part for google.


UPDATE 4/27/2013

I should mention that I am no longer using virpus hosting because they are very unreliable. I bought one VM with them that was based off of OpenVZ. One day I could not complete a simple 'apt-get update' command, it would cause a kernel panic.

I switched over to a Xen instance, but again with nothing installed on a fresh OS, doing an 'uptime' command showed 100% cpu usage. I found and ran a bench.sh script(its on lowendbox.com) that also showed that my VM had less memory than virpus was advertising, around 60MB less.

There is also the part where whenever I would type 'uptime' it was always around 4 hours. The VM was getting rebooted several times per day, I assume from a crash.

I moved from virpus to a vm host called shardhost. Everything went fine until an angry gamer did a DDOS attack on my VM. After that shardhost did something that would shut down the srcds_run process whenever I would start it.

So I would avoid VPS hosting on virpus or shardhost if you are considering it.

Update 7/1/2013 I am leaving shardhost, my vps is almost always down. ugh
Update 7/22/2013 add digitalocean.com to the list of hosts to avoid