• Installing a TF2 Dedicated Server on Ubuntu-14.04 x64

    At the end of Season 13 I bought a VPS (Virtual Private Server) from TragicServers. They have 4 plans and I paid for the Highest. If you compare their plans to other VPS Host this is an amazing deal, and if you wait for a promotion (like I did) you can get it for even cheaper. I would say the only shame is that they don't offer higher packages. I chose a Linux server because it's cheaper and I chose Ubuntu 14 (which is Debian-based) because Valve supports Ubuntu and 14 is the newest edition.

    What can you do with a VPS? Well most people use them to host websites. I use mine to host SPACEBEARS TF2 server and Mumble server. TragicServers only offers VPS in Dallas, which is sort of middle ground as far as servers go and I average 60 ping from Michigan. Like all servers, it has it's unbearable moments but for the most part everyone on my team pings well.

    What is the major benefit of a VPS? It can be cheaper and more dynamic. What is the downside? It is a lot of work! I wrote up these reproduction steps for installing a TF2 server because the current resources out there are terrible, inaccurate and incomplete. I had to go through several resources to get it working properly. I had little to no experience in Linux prior to purchasing this server.

    This walkthrough assumes the server has had the initial setup already (refer to Initial Server Setup by DigitalOcean)

    Log in to your server via SSH (I use PuTTY) as the user you want to install as (do not use root)

    You will need nano if you do not already have it (or another editor)
    Code:
    sudo apt-get update
    sudo apt-get install nano
    (Press Y to Install these packages without verification)

    Because we are using a 64-bit OS and SteamCMD is a 32-bit program we will need some 32-bit libraries
    Code:
    sudo apt-get install lib32gcc1
    (Y to continue, Y to install without verification)

    Download steamcmd (command line version of steam)
    Despite what the Dev site says, do not install anywhere but the homedir (See It is okay to hate steamcmd. It really is bad.)
    Code:
    sudo wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
    Uncompress to that directory using tar
    Code:
    sudo tar -xvzf steamcmd_linux.tar.gz
    Now create a steamcmd script
    Code:
    nano tf2_ds.txt
    edit file with following text:
    login anonymous
    force_install_dir ./tf2
    app_update 232250
    quit
    Press Ctrl+X
    Press Y
    Press Enter

    Now to download and update tf2
    Code:
    ./steamcmd.sh +runscript tf2_ds.txt
    wait for it to finish installing

    Create a shell script to run the server (Note: you do not have to do this but it makes things way easier)
    Code:
    nano tf.sh
    edit file with the following text:
    #!/bin/sh
    tf2/srcds_run -game tf +sv_pure 2 +map cp_process_final.bsp +maxplayers 24 -autoupdate -steam_dir ~/ -steamcmd_script ~/tf2_ds.txt
    Press Ctrl+X
    Press Y
    Press Enter

    Now to launch the server!

    I would recommend running this in screen (comes installed by default). Screen allows you to get back to the server when you close your client. It also allows you to close your client without terminating the server (look into fg (foreground) and bg (background) processes).
    Code:
    screen
    chmod +x tf.sh 
    ./tf.sh
    (Hit Enter after screen)

    to detach and close the screen (do this before closing the client)
    Ctrl+A
    Ctrl+D

    if you need to pull up the server again
    Code:
    screen -dRR
    if you need to stop the server
    Ctrl+C

    To start the server again just enter
    Code:
    ./tf.sh
    Now there is still a lot of configuration left to do. You can do all of these via ssh but I prefer to do them through SFTP (I use vsftpd and FileZilla). You can refer to The Bear Essentials To Running A Server for more direction. Also, you can install a Mumble Server, Setup Fast Download, or plugins like logs.tf or SizzlingStats.

    By setting up the script the way I did the server will check for updates every time it restarts. You can also create a shell script for updating if you would like to do it separate. After installing an update you may have to restart the entire VPS. You can do this in your host's control panel.

    Lastly, if you want your connect info to be a URL instead of an IP (i.e. connect southpawserver.com) then you either need to pay for a domain or signup for a DNS and point it to your server's IP.

    Resources:
    UGC Server Rules | UGC HL Downloads | UGC 6s Downloads
    Official TF2 Wiki | Valve Developer Community
    Ask Ubuntu | Linux Commands
    This article was originally published in forum thread: Installing a TF2 Dedicated Server on Ubuntu-14.04 x64 started by doppel View original post