Setting up a TF2 Server on DigitalOcean

This is supposed to be a simple step-by-step guide to setting up your own server. The server will cost you $20/month, and in exchange you get to be part of the community server renaissance that's going to save TF2 from the matchmaking update.

I am vaguely aware that there are sites where one can just go rent a TF2 server already set up. I didn't personally investigate that option because I'm most comfortable running my own servers for stuff, but it's probably also something to consider. I'm just writing what I know, and what I know is provisioning cloud services.

For tons more details about this process, see:

Hosting

Go to digitalocean.com. Sign up and configure payment and get yourself to the "Create Droplet" page.





Figure 1: The "Create Droplet" Page

After clicking "Create" you will be taken to a list of your servers. Click on the one you just created (also the only one you have, unless you've used DigitalOcean before). This will take you to a server status and control page.





Figure 2: The Server Status Page

Take note of the IP address shown in the upper left. This is how you will be connecting later on unless you set up a domain name for your server. Setting up a domain name isn't going to be covered here because it's easy and I'm too lazy to document that part.

Then go click on the "Console" link in the upper right. (If you set up SSH access during the creation process you can do that instead, but if you don't know what that means just disregard it and open the console). The console will look like this:





Figure 3: The Server Console Login

If the console is filled with other text, press Control-C to clear the screen and get the login prompt. Go ahead and login with the username and password DigitalOcean emailed to you.

Installing

Upon login, you will be greeted with a command line. I'm going to assume you understand the basic idea of a command line already, but if not you can probably figure it out.

Start by installing some necessary packages:



apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32gcc1

Now that the packages are installed we'll create a limited user to run the TF2 server, so that even if somebody manages to hack the server code they don't have full access to your box:



adduser --gecos "" tf2server su tf2server cd

In the future when you log in to the server to make changes, you'll log in as 'tf2server' with the password you set here.

From here on out we'll basically just be following the instructions from the TF2 Wiki "Linux Dedicated Server" page, made more convenient in the form of a shell script which will install TF2 and open the necessary config files for editing:



wget http://www.willdonnelly.net/blog/tf2-server/files/install.sh sh install.sh

The files it's going to open are, in order:

server.cfg

motd.txt

maplist.txt

mapcycle.txt

You can probably just set a server name and rcon password in server.cfg , write a nice message in motd.txt and ignore the other two files.

It should be self-explanatory, but to save the files press Control-X, Y, Enter

Finally, we're going to configure TF2 to launch automatically when the server starts up (note the initial 'exit' command which returns us to root permissions, otherwise this will not work):



exit wget http://www.willdonnelly.net/blog/tf2-server/files/tf2server.conf cp tf2server.conf /etc/init/tf2server.conf start tf2server

Connecting

Remember back when we were creating the server on DigitalOcean?





Figure 4: The Server Status Page (Again)

Take that IP and put it in the "Add Server" box:





Figure 5: Add Server

But you probably figured that out already.

Admin

rcon_password "foo"