How to set up a Team Fortress 2 dedicated server on Ubuntu

Team Fortress 2 Logo

I recently decided that I wanted to set up a dedicated server running Team Fortress 2, the very entertaining multiplayer first-person shooter game by Valve.  I was pleasantly surprised at how easy it was to install and configure a server that runs exactly the way I want.

All Valve multiplayer games run off of the same base server software, Source Dedicated Server (SRCDS). They build a version for Windows, Linux and Mac so you can run it on whatever system you happen to have available. In my case I had Ubuntu 10.04 LTS, which is a great operating system for any server.

This article will give you a walk though guide for installing and configuring srcds on Ubuntu. I am writing specifically about TF2 here, but much of this information will apply to other Source games such as Counter Strike: Source, Left 4 Dead, and Half-Life 2: Deathmatch.

Basic server information

First off a few notes about the software:

  • The first thing that I should point out is the the srcds software is only available in 32-bit. So if you are setting up a server just for Source games then be sure to use the 32-bit version of Ubuntu. You will not gain anything by having the 64-bit version.
  • You may see references to “hlds” in places, hlds stands for Half-Life Dedicated server. This was the name of the old version of srcds (aka Gold Source) that ran the original Half-Life and Counter Strike. Don’t let it confuse you, the name is still used in places but (in this article) it is the same thing as srcds.
  • Depending on what game you’re running and what settings are applied srcds can use a good amount of processor and RAM. You really need at least 512 MB of RAM and a good modern processor to run a TF2 server properly. A gig to two of RAM will be optimal for running a couple instances. To my knowledge the srcds software is not multi-threaded so you wont see any benefits from a dual processor machine.
  • The server will require a huge amount of bandwidth. For a 24 player TF2 server with voice enabled running at max capacity 24/7 expect 800+ gigabytes of bandwidth per month. I regularly see the upload reach 3 Mb/s and download hovers at around 1.5 Mb/s.

Setting up Ubuntu

For a basic system set up walk through please use Part 1 of my guide to setting up an Ubuntu server. Everything in that article is relevant to this guide. The only thing that I should add is be sure not to run SSH on port 27015, since that is the port your Source server will be running on.

One extra step that you might want to do is to create an account for running the srcds process. This isn’t at all required, but it is good practice. The standard practice seems to be creating and account called “hlds” and using that account to run the process.

Also, if you’re running a good firewall (as you should be) remember to poke a hole for port 27015.

Installing Source Dedicated Server

The installation of srcds is handled entirely by the hldsupdatetool created by Valve. This simple little tool will handle the download and installation of your base Source Dedicated Server. The first step in this process is to get the hldsupdatetool.

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

This will download hldsupdatetool.bin to your current directory. Next we need to give this file execute permissions and the run it.

chmod +x hldsupdatetool.bin
./hldsupdatetool.bin

This will run the tool. It will present you with a license agreement, type “yes” and hit enter to proceed. It will install steam into the current directory.

Now we have to run the steam client, which will check to see if it is currently up to date and download a whole bunch of updates. This will take some time.

./steam

Now that steam is up to date and ready to run we are ready to install the Team Fortress 2 server. We do this via the steam client by giving it the following command.

./steam -command update -game tf -dir .

The dot after the -dir flag tells it to install the game server based in the current directory. You can tell it to install wherever you want, but most people just install it in home directory.

If you thought the steam update took a while, you might want to find something else to do for a while, the initial install of the Team Fortress 2 server requires downloading about 3.5 gigabytes of files. This will take a lot of time.

Once it has finished downloading everything it will return you to the console. The game server has been completely installed.

Configuring your server

There are several files that you will want to edit for configuring and setting up your TF2 server. The big one is the server.cfg file located in the orangebox/tf/cfg folder. This file is where you set all of the server variables that control how your server runs.

There are literally hundreds of possible variables in srcds, many of which have no effect on a TF2 server. To simplify this guide I’ll provide you with a very simple sample server config file and talk about some of the more important variables. For a more complete list see the complete list.

Basic server configuration file

// General server settings
hostname "Payload/Control-Point Rotation [Fremont, CA]"
rcon_password "myunguessablepassword"
sv_password ""
sv_lan 0
sv_region 1

// game settings
mp_timelimit 30
mp_maxrounds 4
mp_winlimit 0

// voice settings
sv_voiceenable 1
sv_alltalk 0

// bandwidth rates/settings
sv_allowupload 1
sv_allowdownload 1
sv_minrate 10000
sv_maxrate 0
sv_maxupdaterate 100
sv_minupdaterate 66
sv_mincmdrate 66
sv_maxcmdrate 100

// run in pure mode
sv_pure 1
sv_pure_kick_clients 1

My server config is significantly more complicated than that, but trying to mention every possible variable that you can tinker with would be a huge article unto itself! This basic server config should be enough to get your server up and running with the best practices and and smoothest game play.

Any variable that you don’t explicitly set in the server config file will run it’s default value, which is exactly what you want for 99% of the variables.

General server settings

Most of these variables are pretty self-explanatory. The hostname is the server name that players will see in the server browser, rcon_password is the password for the remote console (make this a strong password), sv_password is the password to join the server (leave blank for a public server), and sv_lan 0 sets the server to run as an internet server (instead of a LAN server).

sv_region

The sv_region variable is quite important. This tells the master list server what region your server is running in so players can filter out servers not in their region. Here are the possible values.

Code Region Code Region Code Region
0 US East coast 3 Europe 6 Middle East
1 US West coast 4 Asia 7 Africa
2 South America 5 Australia 255 World

Game settings

There are three variables in the game setting section, mp_timelimit, mp_maxrounds and mp_winlimit. These are easily confused and mean different things in different types of maps. They are also the ones that new admins are most likely to screw up.

mp_timelimit

The maximum time a game is allowed to be played (in minutes). This one is easy to understand, what is the longest time that you want players to be stuck on a single map? This doesn’t count in the tie-breaker or sudden death round (which defaults to 2 minutes long).

mp_maxrounds

The maximum number of “rounds” that one team can win before the server changes maps. A round is an entire game where the teams win or loose the game. For example, in a payload map a round is everything from the gates opening to the cart being pushed to the last point. In a CTF map a round is from the gates opening to the the point where the winning team has captured the intelligence three times.

mp_winlimit

This is the one that can really screw things up. How many “game points” can one team earn before the server changes the map. In CTF maps a point is 3 intel captures, in payload maps a point is earned every time the cart is pushed to a control point, or a single point is given to the defending team if the round ends without the cart reaching the end, and in control-point maps a point is earned when one team captures the final control point.

Setting this to zero (no limit) works best, especially if you have different maps in your rotation. If you set it to a real number, like 4, then you will find the server changing maps in the middle of a payload game.

Voice settings

These are again self-explanatory, sv_voiceenable is whether or not to support voice chat, and sv_alltalk defines if AllTalk is enabled. If AllTalk is set to 1 then everyone can hear everyone else, if it’s set to 0 then only team mates can hear each other over voice chat. Generally, players use voice chat for tactical information, so set this to 0 unless you have a good reason.

Running the server process (the right way)

Now that your Team Fortress 2 server is installed, configured and ready to go it’s time to start it up. You can do so by running the following command.

./srcds_run -game tf +map ctf_2fort

However, you probably want to be able to log out of your SSH session from time to time. So you will need to run srcds as a service. To do this we will use a shell script and the Screen utility. Screen is a command line multitasking tool that will allow you execute the process and detach it from your current session. Start by installing screen.

sudo aptitude install screen

Now we’re going to create a script called “srcds” in the /etc/init.d folder that will let you start, restart and stop the server with a very simple command.

sudo nano /etc/init.d/srcds

Now paste the following script in the text editor. I cannot take credit for this script, but it works well. I got this script from the Linux SRCDS server article on FreeNerd.net. It’s worth a read since it covers a couple things I wont bother with in this article.

# replace  with the user you created above
SRCDS_USER=""

# Do not change this path
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# The path to the game you want to host. example = /home/newuser/dod
DIR=/home//orangebox
DAEMON=$DIR/srcds_run

# Change all PARAMS to your needs.
PARAMS="-game tf +map pl_badwater"
NAME=SRCDS
DESC="source dedicated server"

case "$1" in
	start)
		echo "Starting $DESC: $NAME"
		if [ -e $DIR ]; then
			cd $DIR
			su $SRCDS_USER -l -c "screen -d -m -S $NAME $DAEMON $PARAMS"
		else
			echo "No such directory: $DIR!"
		fi
		;;

	stop)
		if screen -ls |grep $NAME; then
			echo -n "Stopping $DESC: $NAME"
			kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
			echo " ... done."
		else
			echo "Couldn't find a running $DESC"
		fi
		;;

	restart)
		if screen -ls |grep $NAME; then
			echo -n "Stopping $DESC: $NAME"
			kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
			echo " ... done."
		else
			echo "Couldn't find a running $DESC"
		fi
		echo -n "Starting $DESC: $NAME"
		cd $DIR
		screen -d -m -S $NAME $DAEMON $PARAMS
		echo " ... done."
		;;

	status)
		# Check whether there's a "srcds" process
		ps aux | grep -v grep | grep srcds_r > /dev/null
		CHECK=$?
		[ $CHECK -eq 0 ] && echo "SRCDS is UP" || echo "SRCDS is DOWN"
		;;

	*)
		echo "Usage: $0 {start|stop|status|restart}"
		exit 1
		;;
esac

exit 0

UPDATE: I have created a repository for this script on GitHub. Please check there for the latest version. I would also appriciate it if you would submit issues and pull requests to help improve it!

The highlighted lines are the important ones that you will need to modify. As the instructions say, replace <newuser> with the username that you will be running the service as. This will probably be your username unless you have taken the time to setup a hlds user (a good idea).

The SRCDS_USER variable is the appropriate username, the DIR variable needs to be the path to the orangebox folder and the PARAMS variable are the parameters that will be used when running the server.

Once you have added this script save it by pressing CTRL+X (quit nano) and then Y to save changes.

You can now control the server via the following commands:

/etc/init.d/srcds start
/etc/init.d/srcds restart
/etc/init.d/srcds stop

Depending on your setup you may need to sudo these.

Installing mods

For the most part, I do not recommend installing any game-play mods. Aside from the massive headaches and maintenance issues with outdated mods breaking servers (especially after game updates), Valve put a lot of thought in to TF2 game pacing and balance, and judging by their wild success they seem to have gotten it right. So, if it ain’t broke don’t fix it.

However, the rcon admin system is just plain bad. As a TF2 server admin you will at the very least want to run SourceMod. This srcds addon is a great administration tool and framework for other mods, you will find it to be an invaluable tool for managing your TF2 server.

SourceMod itself is a mod for the srcds mod framework Metamod:Source. So we will have to install that before anything else. This is pretty simple, just download the package and extract the contents to your game directory (orangebox/tf). This will add metamod to the addons folder. Metamod does not really require any configuration, once you have the files in the correct location it’s ready to go.

For a slightly more detailed walk-through check out the official guide: Installing Metamod:Source.

Now you just need to install SourceMod on top of Metamod:Source. This is the same basic process, download the archive and extract the files you your orangebox/tf game directory. You should read the official guide for this as well: Installing SourceMod.

Once you have all of the files in their correct locations then you have successfully installed SourceMod, the base admin tool and the framework for any other mod you could ever want. Restart the server and it should all be up and running.

Adding SourceMod admins

Before you start adding mods you should add yourself (and anyone else you want) as a SourceMod admin. This is quite easy. I personally use Steam IDs to authenticate people as administrators, this is reasonably secure so long as you are running the server with Steam enabled (which you should be).

Start by grabbing your Steam ID. You can easily get the Steam ID of anyone you want from the Steam ID Finder if you know their name.

Now add them to the admin file. Open up orangebox/tf/addons/sourcemod/configs/admins_simple.ini and add the following to the end of the file:

"STEAM_0:1:1234567"    "99:z"

Of course replace the Steam ID with your real Steam ID. This will grant the person with this Steam ID all admin permissions with an immunity value of 99. The next time you join the server you will be able to use the sm_admin command in the console which will bring up a simple little admin menu in-game. You will also be able to use any other the other Admin Commands.

It’s that simple, but it can get as complicated as you want. For more information on the admin format read the Adding Admins guide.

Adding mods/addons/plugins

The AlliedModders forums have basically every mod in existence. It would take another full article to explain the important ones and walk you though configuration, so I’ll just provide you with the basics.

Browse the SourceMod Approved Plugins forum for mod you want to install. The thread will have all of the information you need to configure the mod.

Once you’ve found a mod you want download the mod and install the files in the appropriate locations. Generally the smx files belong in the orangebox/tf/addons/sourcemod/plugins folder and the configuration files belong in the orangebox/tf/addons/sourcemod/configs folder.

Creating a MOTD

TF2 MOTD Screen

TF2 MOTD Screen

The Message of the Day (MOTD) is the intro chalkboard screen you see when you join a server. It is an HTML document that runs in WebKit, so you can do just about anything you like here. Personally, I find the chalkboard look to be the most professional looking MOTD.

The Message of the Day page is located in the orangebox/tf folder as motd.txt. Here you can create your HTML page that will be shown to players who join your server.

I’m not going to try to teach you HTML or CSS, so I’ll simply provide you with the markup for a simple Message of the Day sample page.

Example page markup

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Welcome to the Server</title>
    <style type="text/css">
        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
            color: #ECECEC;
            font-family: Verdana;
        }
        img#bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        #content {
            position: relative;
            z-index: 1;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <img src="http://stevenbenner.com/misc/blackboard.png" id="bg" />
    <div id="content">
        <h1>My TF2 Server</h1>
        <p>
            Welcome to my Team Fortress 2 server.
        </p>
    </div>
</body>
</html>

This is a very basic motd screen. I don’t remember where I got the blackboard graphic, but kudos to whoever did it because it works on just about every resolution. Replace the “Welcome to My Team Fortress 2 server” text with whatever you want.

For more advanced layout you’re going to have to learn some HTML and CSS, Google is your best friend here. Don’t get too crazy though, if your motd is too long then no one will read it.

Updating your server

You will have to occasionally update the server software, whenever Valve releases updates to Steam or the game itself. This is a very simple task, in fact you’ve already done it before. We will be running the same two commands that we used to install the server.

The first thing you need to do is shut down the srcds process.

/etc/init.d/srcds stop

Next you’ll want to execute the Steam software, which will automatically check for updates, and update itself if it needs to.

./steam

Now you’ll need to have srcds check for TF2 updates.

./steam -command update -game tf -dir .

That’s it! Your Steam software and TF2 server software have been fully updated. Now you can start the srcds process again and get back to gaming.

/etc/init.d/srcds start

You’re server is now up and running with the latest updates.

Attracting players

TF2 Server Browser

TF2 Server Browser

This is a tough topic to address, getting players to join your new server can be very difficult, and frankly random. I don’t have a recipe for success to offer you because there just isn’t one. But here are some of the top things that will make your server more desirable to other TF2 players.

  • Have a good ping (<50ms). This is one of the most important things that players will be looking for, a server with low latency will attract many more players than a server with a marginal ping. Of course a server with a terrible ping will never attract anyone because the experience of TF2 is lost on a laggy server.
  • Choose a good name. It should stand out some, but be readable and advertise what makes your server worth playing on. Are you running special mods? Advertise them, not only to tell players what to expect, but to get people who are looking for those mods to notice. If you’re running custom maps you might want to say that as well. But you’re going to have to keep it fairly short, long names get truncated in the server browser.
  • Find a good map rotation. It’s hard to define this, different players are looking for different things. Even today 2Fort seems to attract players (even though I find it fairly boring), but this is more of a personal choice. Pick maps that are actually fun to play on.
  • Set the region code properly. This has become far more important with a recent TF2 update. Setting your region code correctly will allow players to filter by the right region to find your server.
  • Get friends to help jump-start your server. The catch-22 of populating a server is that players tend to only join already populated servers. After all, who want’s to join a server with no one playing? If you have a few people (4-10) that you can coerce into playing on your server at the same time (during peak hours for your region) then you will see random people join. If your server keeps its low ping and stays lag free then it will fill up in no time.
  • Participate, and foster a sense of community. Last, and possibly the most importing item, play on your server. Talk to people, make friends, encourage players and make them feel welcome. Kick and/or ban people who mic-spam (too much) or who stack teams. Make the server fun! And show players that there are admins who will keep the game experience smooth and entertaining.

Finding admins

It is a simple fact, you cannot be on your server 24/7/365. You can make the server more self-sufficient with mods, but you will need other admins to help keep the peace and kick/ban offensive players. I can’t really help you find admins, but I can give some some bullet points to think about.

  • Do not give anyone rcon access. Only the system administrator (you) should know the rcon password. Anyone with the rcon password can do terrible things to your server.
  • Only give full admin permissions to someone you really trust, and only via the SourceMod admin feature. The SourceMod admin has everything necessary to be an admin.
  • The type of people you accept as admins will define the attitude of your server. Make sure their personality is the kind that you want to reflect your server.
  • Bad admins can literally ruin your server. They can ban everyone from the server, change the maps randomly and kill players on a whim.
  • Real life friends are almost always better choices for admin roles than online friends. But there are plenty of good internet people out there.
  • Look for players who frequent your server. The best admins will be the admins who spend a lot of time playing on your server.
  • Do not give admin roles to anyone under 21 years old. Yeah, there are good kids out there, but generally this is an excellent rule.

Basically, be careful about giving out the admin role. Get to know someone (over voice chat) before you offer them an admin role. Good admins will be the single greatest addition to your server, bad admins will spell irrevocable doom.

Conclusion

It’s quite easy to setup a Team Fortress 2 server and keep it running. The hardest and most expensive part will be finding the right host or paying for the colocation at the right data center. If your server takes off and becomes successful you will be able to enjoy a gaming experience custom suited to your tastes. If you’re really lucky you can even offset the costs with donations.

If you’re planning on setting up your own TF2 server then hopefully this article has offered some helpful information and give you some food for thought. If you have any questions please leave a comment below and I’ll respond back asap.

By:
Updated: Aug 20th, 2012

Comments

  1. Hobatter

    A good base start for the TF2 install.
    Running TF2 as a service is a bit more in depth than described. For admins wanting this you may want to read how to use screen before you try. I could not get this to work on Maverick

    Also your Ubuntu setup guide does not tell a user to install & configure the FTP server so you can add sourcemod which is a must to admin the TF2 server. Ubuntu you would
    sudo apt get-install sftpd
    You will then have to edit the vsftpd.conf file and remove the # from the line to allow uploading. Not going into details on how because that is a tutorial of its own. Just a note

    Good job.

  2. Random tech dude

    @Hobatter if you use any kind of decent SSH server (OpenSSH etc) to manage your box, you will know that they come with SFTP included which is very handy and fast. Plus you can install sourcemod by only using console commands, no FTP is really needed.

    For more info http://en.wikipedia.org/wiki/Secure_Shell

  3. Hobatter

    I use Putty generally to administer from a remote pc/netbook and was trying to get the point across about no detail in the FTP transfer (by default uploading is disabled in Ubuntu) and know of no Ubuntu package for sourcemod. You can directly download sourcemod/metamod but in most of the instructions I see they say to extract it first from the compressed file then upload. In the article is says it is fairly easy. I would argue that for anyone with limited Linux experience. I came across this looking for how to run TF2 as a service and still had no luck. I have 10.4 and 10.10 loaded on 2 servers and both give me invalid command when I run
    sudo /etc/init.d/srcds start
    /etc/init.d/srcds start gives me premission errors
    I have tried to load this using a root account and a user account.

  4. Thanks for the feedback. Yeah I probably should tell people how to get these files on to their systems.

    On file transfers

    Personally I don’t run regular FTP servers on my systems, except for file hosting which will only accept anonymous logins. Allowing uploads through FTP is always a bad idea.

    I do use SFTP with FileZilla for secure uploads, but even this I have locked down pretty well. The only place I can upload files is to my home directory. I then have to use the shell to move files around and change their owners.

    I would recommend using SFTP or just wget to acquire files. Since you will be downloading files from the internet anyway wget will skip the middle step.

    When you’re SSH’ed in your home directory you can download and extract files like this:

    wget http://some.domain/directory/filename.tar.gz
    tar xzvf filename.tar.gz

    The wget command downloads the file and tar with the x flag extracts the contents to the current directory. For a nice (human readable) guide on tar check out http://aliyev.ws/?p=34

    Once you have the files extracted you can move them around with the mv command.

    mv mymod.smx orangebox/tf/addons/sourcemod/plugins

    The first part is the file to move, the second part is the destination. You will have to sudo this if the destination directory doesn’t belong to your user/group.

    On your script error

    This should work on basically any version of Ubuntu… I’m not that great at shell scripting, but could you paste the exact error message you get when you try to run the srcds script?

    Generally, you shouldn’t need to sudo the script, but it should prompt your for a password. This will be the password for the user account that you have set it to run the srcds process under (either your regular account or hlds).

  5. Hello.

    I am the gamer/nerd who wrote the guide on freenerd.net. I don’t own freenerd.com which is what your article states after the link. The link is to the correct site, but the comment after of .com will point users to a website I don’t control or own and they want a FORTUNE for.

    Glad you found the guide useful.

    I am working on a linux COD4 guide currently. I have the server online and am in the process of running back over the steps taken to document the process.

    Check it out if you are a COD4 player, Friendly Fire Shire is the name of it.

  6. Fixed. Sorry about the .com/.net mix up!

  7. IJ

    A couple of things:

    :Have a good ping (>50ms)

    Don’t you mean “50ms” means “greater than 50 milliseconds”.

    If you’re using 64-bit Ubuntu like I am, you also need to do the following:

    # apt-get install libc6-i386

    (I don’t use sudo, and please don’t preach to me about it.)

    However, if you are intent on sticking with 32-bit and you have 64-bit-capable hardware, you’re probably better served if you went 64-bit. This is especially true if you do other things on that machine or you want to install a lot of memory (>=4GB). 32-bit processors can only address 4GB of RAM, 3GB of it comfortably (certain segments are reserved for items such as video memory and the iike). Even with PAE (Physical Address Extension) enabled, it still has to jump through hoops to use the additional memory.

    –IJ.

  8. Less-than 50ms
    Yeah, had the wrong symbol in front of the 50ms number. Changed that to a less-than symbol.

    32 bit vs 64 bit OS
    If you’re going to have more than 4GB of memory then yes, you absolutely need to be running a 64 bit operating system. Though if the box is a dedicated to hlds then you don’t need that much ram anyway. In my experience the hlds process is more CPU hungry than RAM hungry.

    On the other hand, If you’re sure that you will never have more than 4GB of memory on that server (VPS, cheap dedicated server, or small home server) then you are much better off with a 32 bit operating system. It will take less memory overhead to run the OS, leaving more for services, and since the hlds process is 32 bit nothing will be gained by having it run on a 64 bit system.

    Personally, I can’t swing the money for a big dedicated server or a colocation contract, and my home DSL would never support a game server so I would never need a 64-bit OS on the server.

  9. nitramneb

    Hi Steve
    I have been having the same trouble as Hobatter

    sudo /etc/init.d/srcds start

    gives me
    command not found.

    Which is strange the file is defiantly in the directory I can see it in GUI and can do an LS in putty in the directory and see it as well.

    A friend of mine says it may be the permissions?? (i’m sure we gave the account full permission) or the type of file the GUI identifies it as a plain txt document everything else is ssh

  10. nitramneb

    Solved it with

    sudo chmod a+x /etc/init.d/srcds

  11. cralor

    nitramneb has a great tip!

    This fixed the permission issues I was having with 10.10!

    Thanks for the guide!

  12. Just a heads up. There is a typo in the ‘srcds’ script. Nothing major, but when you grep for when the process is running you need to look for ‘srcds_r’ not ‘hlds_r’ in this line:

    ps aux | grep -v grep | grep hlds_r > /dev/null

    otherwise it shows the service as always down.

    Thanks for the succint intro on setting up a server. I had my home TF2 server up and running in just a couple of hours!

  13. GUANCH3

    very good tutorial, the best that I have read the tf2

  14. Ape

    The init.d script in this tutorial starts 2 instances of SRCDS. It needs to be updated.

  15. John Machacek

    Ape – I had the issue as well, I am no expert but my solution was to comment ‘#’ out line 19

    replace ” screen -d -m -S $NAME $DAEMON $PARAMS ” with “# screen -d -m -S $NAME $DAEMON $PARAMS ” and I no longer have 2 instances.

    Steven – This is an AWESOME resource, thank you for taking the time to put this together!

  16. Justin

    I’m getting a syntax error when I try to start the script.

    12: Syntax error: word unexpectd (expecting “in”)

    Mine line 12 reads exactly as shown on this page.

  17. Fantastic guide! Everything is working flawlessly. Thanks so much.

  18. avin

    when I sudo /etc/init.d/srcds1, it open 2 screen for me? (screen -ls). is this nomal?

  19. @John Machacek

    Thank you! I was wondering why there were two instances running…

    @avin

    See John Machacek’s response to Ape.

  20. avin

    @Cyrozap, Yaaa. Is working thanks
    @Ape, Thanks to you. :)

  21. Andrew

    This is great! Thanks for the awesome guide!
    I’m having a couple of issues with it though. The first is that when I use “screen -r SRCDS” and then detach the screen once I’m done (using ctrl-a d) if I try to stop the server the script can’t find the screen even though it appears in “screens -ls” as “.SRCDS”. I’m not sure whats happening there. The other is that on start up the server doesn’t run. I know that my user can’t use the “su” command which is used in the script. Can I change the script to use sudo instead or are there any other fixes?

  22. I am trying to transition to Linux from windows. I have a couple questions.

    1. Does running srcds as a service restart the service if it locks up?
    2. I also would like to know how to autoupdate in linux.

  23. Andrew

    To autoupdate in Linux, put -autoupdate somewhere in the terminal command that you use to start your server. There’s a YouTube video that shows this as well.

    My questions are 1) If I made changes to my server.cfg file and want them to go into immediate effect, do I have to stop the server or is there something fancy I can do to “restart” it so to speak?

  24. Sindre

    Just a tip for saving time;
    instead of running
    /etc/init.d/srcds (start/stop/restart)
    you can just run
    service srcds (start/stop/restart)

    also, if you get “command not found” you’ll need to run:
    sudo chmod +x /etc/init.d/srcds
    to make it executable :)

    Otherwise, very nice tutorial, it helped me alot. :)

  25. Mike

    Has anyone tried this in 2012 (the instructions on this page are from 2010)?

    I’m at this step:

    $ ./srcds_run -game tf +map ctf_2fort
    and it returns a lot of error messages:

    Network: IP 10.222.156.24, mode MP, dedicated Yes, ports 27015 SV / 27005 CL
    Failed to load $include VMT file (materials/TILE/FLOOR_TILE_001A.vmt)
    Failed to load $include VMT file (materials/TILE/FLOOR_TILE_001A.vmt)
    Failed to load $include VMT file (materials/TILE/FLOOR_TILE_001A.vmt)
    Failed to load $include VMT file (materials/TILE/FLOOR_TILE_001A.vmt)
    …etc and then ends on
    Looking up breakpad interfaces from steamclient
    Calling BreakpadMiniDumpSystemInit
    ‘server.cfg’ not present; not executing.
    ‘ctf_2fort.cfg’ not present; not executing.
    Connection to Steam servers successful.
    Public IP is 99.111.39.126.
    Assigned anonymous gameserver Steam ID [A-1:987911168(2997)].
    VAC secure mode is activated.
    Connection to game coordinator established.
    Current item schema is up-to-date with version 6C7F42A0.
    tf_server_identity_account_id not set; not logging into registered account

    Any idea on what’s going on or what I should do?

  26. J

    I found this to work better:

    #Daemon Name = SRCDS
    # replace with the user you created above
    SRCDS_USER=””
    # Do not change this path
    PATH=/bin:/usr/bin:/sbin:/usr/sbin
    # The path to the game you want to host. example = /home/newuser/dod
    DIR=/home//tf2/orangebox/
    DAEMON=$DIR/srcds_run
    # Change all PARAMS to your needs.
    PARAMS=”-console -game tf +map ctf_2fort -maxplayers 30 -autoupdate”
    NAME=SRCDS
    DESC=”source dedicated server”
    case “$1” in
    start)
    echo “Starting $DESC: $NAME”
    if [ -e $DIR ];
    then
    cd $DIR
    su $SRCDS_USER -l -c “screen -d -m -S $NAME $DAEMON $PARAMS”
    else echo “No such directory: $DIR!”
    fi
    ;;
    stop)
    if su $SRCDS_USER -l -c “screen -ls |grep $NAME”
    then
    echo -n “Stopping $DESC: $NAME”
    su $SRCDS_USER -l -c “screen -S SRCDS -X quit ” #This kills the screen (SRCDS) and server process.
    echo ” … done.”
    else
    echo “Couldn’t find a running $DESC”
    fi
    ;;
    restart)
    if su $SRCDS_USER -l -c “screen -ls |grep $NAME”
    then
    echo -n “Stopping $DESC: $NAME”
    su $SRCDS_USER -l -c “screen -S SRCDS -X quit ”
    echo ” … done.”
    else
    echo “Couldn’t find a running $DESC”
    fi
    echo -n “Starting $DESC: $NAME”
    cd $DIR
    su $SRCDS_USER -l -c “screen -d -m -S $NAME $DAEMON $PARAMS” #This kills the screen (SRCDS) and server process.
    echo ” … done.”
    ;;
    status)
    # Check whether there’s a “srcds” process
    ps aux | grep -v grep | grep srcds_r > /dev/null
    CHECK=$?
    [ $CHECK -eq 0 ] && echo “SRCDS is UP” || echo “SRCDS is DOWN”
    ;;
    *)
    echo “Usage: $0 {start|stop|status|restart}”
    exit 1
    ;;
    esac
    exit 0

  27. Josh

    How do I edit config.cfg?

    Also, I can’t find config.cfg!

    Here’s the files in /orangebox/tf/cfg

    root@10004:~/orangebox/tf/cfg# ls
    360controller.cfg heavyweapons.cfg sfm_defaultanimationgroups.txt
    chapter1.cfg medic.cfg sniper.cfg
    chapter2.cfg mtp.cfg soldier.cfg
    chapter3.cfg pyro.cfg spy.cfg
    config.360.cfg replay.cfg undo360controller.cfg
    config_arena.cfg replay_ftp.cfg user_default.scr
    config_default.cfg replay_local_http.cfg valve.rc
    demoman.cfg scout.cfg
    engineer.cfg settings_default.scr

  28. White Light

    Is there a way to possibly make it so that I can execute a server command while still using screen? I know that if I run the server software normally, I can input commands directly into the server, but with screen I can’t do that anymore. How could I do this without having to restart the server?

  29. tweak

    you need to resume your screen session
    do the following
    screen -ls (look for your screen session)
    screen -r [the name or your session]

  30. tweak

    Also I also do not have the server.cfg file did they change things with the pyro patch?

  31. Update on the service script:

    I have created a repository for this script on GitHub. Please check there for the latest version. I would also appriciate it if you would submit issues and pull requests to help improve it!

    https://github.com/stevenbenner/srcds-service

  32. Bojidar

    I don’t have the addons folder

  33. theREALsaxtonHALE

    Nice guide but Outdated source dedicated server is broken (I think this occurred in the 2012 halloween update) and doesn’t work anymore. You can still run a dedicated server but now it’s more complicated and will not be on the public/online server list.

  34. Hello

    I started my server with the user account tf2server and I wrote /etc/init.d/srcds start. PuTTY then writes the following: “Starting source dedicated server: SRCDS” I have to type in my Password for the tf2server user. After I typed it and pressed return, nothing more happens. The server is running, but how can I use the tf2 server console, e.g. for using “meta list” for checking if the metamod and the sourcemod plugins are running? And shouldn’t there be more things written in the PuTTY console?

  35. Just got one started at the college I was at with a few of my friends. What happened after was the best fun that I have ever had in college. Stayed up the whole night playing with a group of friends.

  36. Lapiz

    Hey I was looking for a picture of the TF2 Chalkboard by itself, and I wanted to use it as a background for my webpage. I did not want to steal anyone’s work, so I clicked on it and it brought me here. I was wondering if this image is subject to copy right, and if it is not can I use it for my Web Page?

  37. Unfortunately I don’t remember where I found the chalkboard background image. I did not make it and I have no claim to it. It would probably be best if you did not use it on a for-profit site, but I wouldn’t be too concerned about using on a personal for-fun site.

    It’s simple enough that you could easily make one from scratch with some basic image editing skills. Create an off-center radial gradient from light-gray to dark-gray, apply a distortion filter of some kind, then apply a thick gaussian blur.

  38. Sam

    Nice

Leave a reply

Pages linking to this article