Create a TF2 Server on DigitalOcean + Metamod + Sourcemod + Halloween Auto Farm Teleport
Learn how to create your own Teamfortress 2 dedicated server on a VPS, install metamod/sourcemod and how to setup cycled automatic teleporting to dropped gift spots on TF2 halloween maps (if you want). Approximate time to set everything up from scratch is about 1 hour, at the cost of $5 per a month on a DigitalOcean VPS droplet.
Sign up & Setup a DigitalOcean Server
1. Go to DigitalOcean and sign up for an account.
2. Login and add $5 via paypal or add a credit card. If you choose to use a credit card, you'll get an authorization charge of $1.23 which will be refunded within 30 days.
3. Select Droplets and click Create Droplet.
4. Droplet Hostname: enter a droplet hostname, for example tf2 or you can use a domain name but setting that up is beyond this guide.
5. Select Size: $5 a month appears to be enough for a 12 person server CPU usage is around 30% with under 1 Mbps up/down. Go with the $10 month if you want more space, ram and transfer limit, probably enough for a 24 person server.
6. Select Region: Choose the closest region to yourself to get better ping.
7. Available Settings: Leave everything unchecked unless you require something specific here.
8. Select Image: Choose Ubuntu 14.04 x32, most of this guide will apply to other distributions. You can choose x64 if you have greater than 4GB RAM, but you may need to modify some steps.
9. Add SSH Keys (Optional): Choose if you know how to setup SSH keys, you will not be emailed a temporary password in this case.
10. Click Create Droplet, the server will startup and you will be emailed a temporary root password along with the server ip.
Connect to your DigitialOcean server via SSH
1. If you are using Windows, download PuTTY which is a free SSH client (first choice under For Windows on Intel x86) , or find a SSH client for your OS.
2. Start up PuTTY and under session you will see an area to enter Host Name (or IP address), type in your server's ip, leave at default of 22, and click open.
3. You'll be asked to login, enter root as login and the emailed password.
4. After this you'll be asked to repeat your password and set a new one.
Install SteamCMD on Ubuntu 14.04 x32
Please note: This guide is for 32bit, if you selected 64bit you will need to install 32bit libs. By running "sudo apt-get install lib32gcc1 ia32-libs gcc-multilibs" in terminal. Note I haven't tested this. If you selected Ubuntu 14.04 x32 then just skip this part.
Now we are going to download steamcmd and extract it. You'll need to type the following commands into the terminal and press enter after each command.
Make a steam directory for steamcmd.
Go into the steam directory via cd command.
Download the compressed steamcmd file using wget command.
Extract steamcmd_linux.tar.gz, the command tar will extract the .tar.gz file xzf are options x = extract, z = specifies that it is compressed, f = to find the file (so it always has to end with an f).
tar xzf steamcmd_linux.tar.gz
Remove the .tar.gz file to keep things clean using rm command.
Go back a directory using cd ..
Move steam directory to /opt/ to keep things clean.
mv steam/ /opt/
Create a special steam user, but disable this user from login so you can launch tf2 in the future with this user and not root.
adduser --disabled-login steam
Change ownership of /opt/steam/ recursively to steam user and steam subgroup.
chown -R steam:steam /opt/steam/
Install and Update TF2 Dedicated Server using SteamCMD
You will need to run this part anytime there is a tf2 server update.
Run/update steamcmd as steam user.
su - steam -c "/opt/steam/steamcmd.sh"
Login inside of steamcmd as anonymous.
Now we will install or update the TF2 dedicated server using steamcmd.
Select directory for tf2.
Update tf2, it may take a while, allow it to complete, usually 10-20 minutes. If it doesn't complete properly which happens sometimes you'll need to do it again.
Once everything is finished quit steamcmd.
Random Linux Quizview quiz statistics
Start TF2 Dedicated Server
Go into tf2 directory
Run tf2 server with the parameters, for example:
./srcds_run -game tf +map ctf_2fort +maxplayers 12
Wait around a minute for the tf2 server to start and connect to your server from within Teamfortress 2, you can use the command connect followed by the ip address of your server inside tf2 console to connect to your server.
Now one problem you may encounter is once you close PuTTY your server will stop running. To solve this you will need to run the server inside of program called screen and detach session.
So it would look like this.
Followed by starting the server.
./srcds_run -game tf +map ctf_2fort +maxplayers 12
Press ctrl + a then d (to detach session), to go back type.
Or if you get a list of sessions type.
screen -r sessionnumber
Now you can close PuTTY and your tf2 server will continue running.
Up to this point this guide is based and expanded on Kavex's - How to make a cloud VPS for Team Fortress 2, I would like to thank Kavex for making it.
For further commands and such take a look here: http://wiki.teamfortress.com/wiki/Linux_dedicated_server#Other_command_line_options
Setup Metamod and Sourcemod on your DigitalOcean TF2 Server
If you want to run plugins on your TF2 server you will require Metamod and Sourcemod. This is a required step to make a Teamfortress Halloween Auto Teleport Farming server.
First I would like to mention that there appears to be issue an with the stable release of Metamod that from my experience prevents loading of sourcemod causing a "segmentation fault (core dumped)" error, using snapshot releases instead resolves this issue.
Make sure you have stopped your TF2 server first, type exit in the server console and then press ctrl + c
Go into /opt/steam/tf2/tf/ directory
Download metamod first, http://www.metamodsource.net
We will use the latest snapshot, make sure to check that link, versions will change with time or maybe the stable release will be fixed soon.
tar xzf mmsource-1.11.0-git952-linux.tar.gz
Edit metamod.vdf to change the directory to tf using nano.
Make sure it looks like this.
Now to save metamod.vdf inside nano press ctrl + o to save and ctrl + x to exit nano.
Make sure you are still in /opt/steam/tf2/tf/ directory.
Download sourcemod, latest snapshot works right now, http://www.sourcemod.net/snapshots.php
tar xzf sourcemod-1.7.0-git4913-linux.tar.gz
Run your server as before and test that both metamod and sourcemod are running, once you are in the server console run the following to test meta mod first.
You should see:
] meta list
Listing 1 plugin:
You can also run sm command to test sourcemod.
For further details take a look here: https://wiki.alliedmods.net/Installing_sourcemod
Also here an advanced guide to adding admins: https://wiki.alliedmods.net/Adding_Admins_%28SourceMod%29
But I will let you know how to setup it up quick and dirty. First go to steamrep and find your steam profile. Now find your steamID32 for example STEAM_0:1:9876543.
Open admins_simple.ini using nano.
Add your steamid and give it all permissions and say 99 immunity level, go to the bottom of the file and add something like this.
Don't forget that this is an example your steamid would be unique. Save and close nano as before. Now when you connect to your server, you can type sm_admin in tf2 client console and you will see the admin menu.
Setup a Halloween Auto Teleport Server
To setup timed automatic cycled teleporting to Halloween gifts, you will require at least 2 plugins. The first is a teleport plugin for sourcemod the second is a cron like plugin for sourcemod which can repeat the commands to teleport over and over on a timed loop.
The teleport plugin is available here: https://forums.alliedmods.net/showthread.php?t=219358
Server crontab v188.8.131.52 can be used to repeat commands: https://forums.alliedmods.net/showthread.php?p=523298?p=523298
I also recommend the following plugins.
classenforcer v0.2.1: https://forums.alliedmods.net/showthread.php?t=87748?t=87748
This will allow you to force a class, useful because heavy has a big hitbox and if I am not mistaken it's easier for him to pick up gifts.
godmode v2.3.1: https://forums.alliedmods.net/showthread.php?p=979550?p=979550
Allows godmode, so people don't kill each other.
thirdperson v2.1.0: https://forums.alliedmods.net/showthread.php?p=1694178?p=1694178
Allows thirdperson view, easier to see the gift.
There isn't an easy way to download from the forum via wget, I recommend to do it on your local OS and create a custom .tar.gz file which you can then upload to your server and easily extract inside your tf2 directory. It makes this process far easier.
You can use 7zip to first make a .tar file by selecting tar under Archive format and then compress the tar file with gzip under Archive format to make a .tar.gz file.
Now once you've downloaded all the plugins and files the directory structure will need looks like this.
Also for crontab you will need the .cfg files
I don't believe the .sp files are needed as they are the source files for the scripts (correct me if I am wrong), but if you want you can include them as well in the correct folder structure.
I have found the positions for koth_lakeside_event map gift drops, however you will need to find your own for other maps. The sc_jobs.cfg for koth_lakeside_event looks like this:
sc_addjob ? ? ? ? ? ? "sm_teleport @all -1126.240478 -1818.691894 6.971355" // 01
sc_addjob ? ? ? ? ? ? "wait 200; sm_teleport @all -974.335449 -1155.431884 -203.901336" // 02
sc_addjob ? ? ? ? ? ? "wait 400; sm_teleport @all -566.475830 -873.728576 -174.271972" // 03
sc_addjob ? ? ? ? ? ? "wait 600; sm_teleport @all -341.459259 -1081.812500 16.031250" // 04
sc_addjob ? ? ? ? ? ? "wait 800; sm_teleport @all -0.682400 -907.488830 48.031250" // 05
sc_addjob ? ? ? ? ? ? "wait 1000; sm_teleport @all 317.792114 -1090.607421 16.031250" // 06
sc_addjob ? ? ? ? ? ? "wait 1200; sm_teleport @all 568.532653 -876.659301 -174.46414" // 07
sc_addjob ? ? ? ? ? ? "wait 1400; sm_teleport @all 969.528076 -1127.955688 -206.488876" // 08
sc_addjob ? ? ? ? ? ? "wait 1600; sm_teleport @all 1126.398925 -1804.132202 7.879253" // 09
sc_addjob ? ? ? ? ? ? "wait 1800; sm_teleport @all -9.570353 -1834.422119 16.031250" // 10
sc_addjob ? ? ? ? ? ? "wait 2000; sm_teleport @all -949.383056 0.075070 -228.994049" // 11
sc_addjob ? ? ? ? ? ? "wait 2200; sm_teleport @all -515.741088 -38.765487 -173.965255" // 12
sc_addjob ? ? ? ? ? ? "wait 2400; sm_teleport @all -424.613220 -4.912599 -15.968750" // 13
sc_addjob ? ? ? ? ? ? "wait 2600; sm_teleport @all -292.190338 -547.924743 -140.329330" // 14
sc_addjob ? ? ? ? ? ? "wait 2800; sm_teleport @all -192.416305 -528.865417 -15.968750" // 15
sc_addjob ? ? ? ? ? ? "wait 3000; sm_teleport @all 192.169799 -538.893310 -15.968750" // 16
sc_addjob ? ? ? ? ? ? "wait 3200; sm_teleport @all 295.673522 -545.523742 -141.005065" // 17
sc_addjob ? ? ? ? ? ? "wait 3400; sm_teleport @all 416.960571 1.562003 -15.968750" // 18
sc_addjob ? ? ? ? ? ? "wait 3600; sm_teleport @all 519.202514 -4.683027 -173.946090" // 19
sc_addjob ? ? ? ? ? ? "wait 3800; sm_teleport @all 934.588012 -28.897510 -228.69720" // 20
sc_addjob ? ? ? ? ? ? "wait 4000; sm_teleport @all -874.714355 1038.539428 -207.968750" // 21
sc_addjob ? ? ? ? ? ? "wait 4200; sm_teleport @all 884.925842 1045.615356 -207.961746" // 22
sc_addjob ? ? ? ? ? ? "wait 4400; sm_teleport @all 1.585826 596.587768 16.031250" // 23
sc_addjob ? ? ? ? ? ? "wait 4600; sm_teleport @all -1126.240478 -1818.691894 6.971355" // 01
sc_addjob ? ? ? ? ? ? "wait 4800; sm_teleport @all -974.335449 -1155.431884 -203.901336" // 02
sc_addjob ? ? ? ? ? ? "wait 5000; sm_teleport @all -566.475830 -873.728576 -174.271972" // 03
sc_addjob ? ? ? ? ? ? "wait 5200; sm_teleport @all -341.459259 -1081.812500 16.031250" // 04
sc_addjob ? ? ? ? ? ? "wait 5400; sm_teleport @all -0.682400 -907.488830 48.031250" // 05
sc_addjob ? ? ? ? ? ? "wait 5600; sm_teleport @all 317.792114 -1090.607421 16.031250" // 06
sc_addjob ? ? ? ? ? ? "wait 5800; sm_teleport @all 568.532653 -876.659301 -174.46414" // 07
sc_addjob ? ? ? ? ? ? "wait 6000; sm_teleport @all 969.528076 -1127.955688 -206.488876" // 08
sc_addjob ? ? ? ? ? ? "wait 6200; sm_teleport @all 1126.398925 -1804.132202 7.879253" // 09
sc_addjob ? ? ? ? ? ? "wait 6400; sm_teleport @all -9.570353 -1834.422119 16.031250" // 10
sc_addjob ? ? ? ? ? ? "wait 6600; sm_teleport @all -949.383056 0.075070 -228.994049" // 11
sc_addjob ? ? ? ? ? ? "wait 6800; sm_teleport @all -515.741088 -38.765487 -173.965255" // 12
sc_addjob ? ? ? ? ? ? "wait 7000; sm_teleport @all -424.613220 -4.912599 -15.968750" // 13
sc_addjob ? ? ? ? ? ? "wait 7200; sm_teleport @all -292.190338 -547.924743 -140.329330" // 14
sc_addjob ? ? ? ? ? ? "wait 7400; sm_teleport @all -192.416305 -528.865417 -15.968750" // 15
sc_addjob ? ? ? ? ? ? "wait 7600; sm_teleport @all 192.169799 -538.893310 -15.968750" // 16
sc_addjob ? ? ? ? ? ? "wait 7800; sm_teleport @all 295.673522 -545.523742 -141.005065" // 17
sc_addjob ? ? ? ? ? ? "wait 8000; sm_teleport @all 416.960571 1.562003 -15.968750" // 18
sc_addjob ? ? ? ? ? ? "wait 8200; sm_teleport @all 519.202514 -4.683027 -173.946090" // 19
sc_addjob ? ? ? ? ? ? "wait 8400; sm_teleport @all 934.588012 -28.897510 -228.69720" // 20
sc_addjob ? ? ? ? ? ? "wait 8600; sm_teleport @all -874.714355 1038.539428 -207.968750" // 21
sc_addjob ? ? ? ? ? ? "wait 8800; sm_teleport @all 884.925842 1045.615356 -207.961746" // 22
sc_addjob ? ? ? ? ? ? "wait 9000; sm_teleport @all 1.585826 596.587768 16.031250" // 23
sc_addjob ? ? ? ? ? ? "wait 9200; sm_teleport @all -173.608474 -1046.205932 16.031250; wait 9400; sm_teleport @all 165.538299 -1012.248413 16.031250" // 24
sc_addjob ? ? ? ? ? ? "wait 9999"
You should also create a custom server.cfg file which should be in /tf/cfg/server.cfg, here is an example some commands are from the plugins above. You'll need to do research to make this perfect.
Very important go read about tf_server_identity stuff, you'll need this for quickplay and halloween drops (if I am not mistaken): https://support.steampowered.com/kb_article.php?ref=2825-AFGJ-3513
// Server Name
hostname "Koth_Lakeside_Event Gift Farm Teleport Server" //Name of your server, change it
tf_forced_holiday "2" //Halloween mode
tf_server_identity_account_id ##### //Make sure to change this
tf_server_identity_token "#####" //Make sure to change this
sm_ce_enable 1 //Enable class enforcer plugin
sm_ce_blue heavy //Forced class for the blue team
sm_ce_red heavy //Forced class for the red team
sm_ce_admin //Override forced class for admins with slay
sm_godmode_spawn 1 //Enable godmode on spawn
// Rcon Cvars
rcon_password "" //Make sure to change this, remote control password
sv_rcon_banpenalty 0 //Number of minutes to ban users who fail rcon authentication
sv_rcon_log 0 //Enable/disable rcon logging
sv_rcon_maxfailures 3 //Max number of times a user can fail rcon authentication before being banned
sv_rcon_minfailures 5 //Number of times a user can fail rcon authentication in sv_rcon_minfailuretime before being banned
sv_rcon_minfailuretime 10 //Number of seconds to track failed rcon authentications
// Server Password
sv_password "" //Password protects server, no one can join without password
// Server Cvars
tf_avoidteammates_pushaway 0 //Controls player collision, 1 = allow (default), 0 = off (players walk through each other)
mp_allowspectators 0 //Toggles whether the server allows spectator mode or not
mp_forceautoteam 1 //Automatically put players on a team upon joining game
mp_defaultteam 0 //Controls which team mp_forceautoteam will make players join, 0 = random
mp_humans_must_join_team any //Can be set so that humans can only join a certain team (any, blue, red, spectator)
mp_autoteambalance 0 //Toggles server autoteambalance
mp_bonusroundtime 5 //Time in seconds after round win until round restarts
mp_chattime 5 //amount of time in seconds players can chat after the game is over
mp_disable_autokick 1 //Prevents a userid from being auto-kicked
mp_enableroundwaittime 0 //Enable timers to wait between rounds.
mp_fadetoblack 0 //fade a player's screen to black when he dies
mp_falldamage 0 //Amount of damage players sustains from a fall
mp_flashlight 0 //Toggles flashlight on or off
mp_footsteps 1 //Toggles footsteps on or off
mp_forcecamera 0 //Restricts spectator modes for dead players
mp_idlemaxtime 999999 //Max time a player is allowed to be idle (in minutes)
mp_maxrounds 999999 //Max number of rounds to play before server changes maps
mp_teams_unbalance_limit 0 //Teams are unbalanced when one team has this many more players than the other team. (0 disables check)
mp_time_between_capscoring 0 //Delay between scoring of owned capture points.
mp_timelimit 999999 //Game time per map in minutes
mp_winlimit 999999 //Max number of rounds one team can win before server changes maps
sv_allow_color_correction 1 //Allow or disallow clients to use color correction on this server.
sv_allow_wait_command 1 //Allow or disallow the wait command on clients connected to this server.
sv_allowdownload 1 //Allow clients to download files
sv_allowupload 0 //Allow clients to upload customizations files
sv_alltalk 1 //Players can hear all other players, no team restrictions
sv_alternateticks 0 //If set, server only simulates entities on even numbered ticks.
sv_autosave 0 //Set to 1 to autosave game on level transition. Does not affect autosave triggers.
sv_bonus_challenge 0 //Set to values other than 0 to select a bonus map challenge type.
sv_cacheencodedents 1 //If set to 1, does an optimization to prevent extra SendTable_Encode calls.
sv_cheats 0 //Allow cheats on server
sv_clearhinthistory 0 //Clear memory of server side hints displayed to the player.
sv_consistency 0 //Whether the server enforces file consistency for critical files
sv_contact "" //Contact email for server sysop
sv_downloadurl "" //Location from which clients can download missing files
sv_enableoldqueries 1 //Enable support for old style (HL1) server queries
sv_pausable 0 //Is the server pausable.
// Lan or internet play, Server region cvars
sv_lan 0 //Server is a lan server ( no heartbeat, no authentication, no non-class C addresses )
sv_region 255 // Region Codes: 0 - US East coast, 1 - US West coast, 2 - South America, 2 - South America, 3 - Europe, 4 - Asia, 5 - Australia, 6 - Middle East, 7 - Africa, 255 - world
sv_log_onefile 0 //Log server information to only one file.
sv_logbans 1 //Log server bans in the server logs.
sv_logblocks 0 //If true when log when a query is blocked (can cause very large log files)
sv_logecho 0 //Echo log information to the console.
sv_logfile 0 //Log server information in the log file.
sv_logflush 0 //Flush the log file to disk on each write (slow).
sv_logsdir "logs" //Folder in the game directory where server logs will be stored.
sv_maxcmdrate 0 //(If sv_mincmdrate is > 0), this sets the maximum value for cl_cmdrate.
sv_maxrate 40000 //Max bandwidth rate allowed on server, 0 == unlimited
sv_maxreplay 2 //Maximum replay time in seconds
sv_maxupdaterate 105 //Maximum updates per second that the server will allow
sv_mincmdrate 0 //This sets the minimum value for cl_cmdrate. 0 == unlimited.
sv_minrate 0 //Min bandwidth rate allowed on server, 0 == unlimited
sv_minupdaterate 100 //Minimum updates per second that the server will allow
You may also want to edit /tf/cfg/motd_default.txt this is the message users first see when they connect, also known as the message of the day.
Once you gather all the files and make them in the correct folder structure make it a tar.gz file via 7zip as described before and upload to a server if you have one, if not you can probably use dropbox or anywhere else which has direct linking to files. Make sure it's somewhat secure and you can remove it after, since you will have your rcon password in here, unless you leave important stuff out and later edit via nano inside the server terminal. Another method is via secure copy (scp) but requires time/research to setup, beyond the scope of this guide.
Once you have your tar.gz file for example tf.tar.gz go into your /opt/steam/tf2/tf/ directory and wget the file for your server then extract it, for example: tar xzf tf.tar.gz
You should be good at this point, here is a way to start your server for koth_lakeside_event map.
./srcds_run -game tf -hostport 27015 +fps_max 60 +maxplayers 12 +map koth_lakeside_event
Creating cycled teleporting for other maps to get gifts is possible as well, but will take time and you will need to rewrite the sc_jobs.cfg file.
You will need to go to the exact part of the map where the gift spawns and use sm_getloc to get the location number
For example if sm_getloc reports -974.335449 -1155.431884 -203.901336
You will need to make a new script with, the wait command is what determines the order of cycle and wait time. The wait time is not determined by time in seconds, but by server fps in time. So if server gets 60 fps a second, a wait of 120 will execute in 2 seconds. Server fps can fluctuate so unfortunately it's not an exact timer sometimes.
sc_addjob ? ? ? ? ? ? "wait 120; sm_teleport @all -974.335449 -1155.431884 -203.901336"
I hope this explains the basics and good luck, if I made any mistakes please correct me in the comments. This part took me a while to figure out last year, so this overview should help many of you.