Updated March 14, 2011
View the DreamHost Forum Discussion on this.
By now most people know I am using Dreamhost Private Servers to run Team Fortress 2 game servers, so I decided it’s time to share the secret to running a 32 slot TF2 server for $11 a month (bundled) or $15 a month (single).
First off, you pay for a Dreamhost PS per how much ram you need, after careful testing with some trial and error, I found out that on Linux a basic 32 slot TF2 server, when completely filled will only use about 250mb of ram, thus the minimum @ Dreamhost for a PS (300mb) is perfect for any basic server, now if your going to be running a ton of plugins, you may want to drag that resource allocation bar up to around 450mb just to be safe.
Anarchy99 currently has 3 servers running off of the Dreamhost PS shells, each one its own PS, and bundled they are anywhere from $8/mo to $15/mo each.
Lets get started then, shall we?
To start, your gonna need Dreamhost hosting, they are an excellent company to use, and I highly recommend them to anyone in the market for web hosting, at the moment you can get amazing hosting for $2/mo, same hosting I have for my personal things, in fact. Upon registration enter the email ”firstname.lastname@example.org” as a referral email, earn me a good name!
Now that you have the hosting
You should have gotten a free domain upon registration (I told you they were awesome!), anyways go in your Dreamhost panel and scroll down to “Private Servers” on the left menu, then click “Enable DreamHost PS”, go through the little setup and wait for the email that says its ready, once you get that go back in your panel and click “Manage Resources” to be sure its up, the first week of PS is free, thus they give you an absurd amount of ram to use for the first week (2300mb default), when that week is up, the slider is automatically moved to whatever you use, I out of habit just set it at 300 or 350 once I enable a new server (you can have as many PS’s at a time as you want).
Add new user for the ps and subdomain
This first thing to do after your PS is ready is to create a new user for that server. On the left menu, click “Manage Users” and then click “Add a New User”, setup the user any way you wish, just make sure it has “SHELL” ticked as its access, and the server on the dropbox set to your PS.
Now that you have a user, set a sub domain to it.
In order to use your FTP to upload/edit files on the server you need to set a sub domain on the user, click the “Manage Domains” link in your DreamHost panel and click “Add New Domain / Sub Domain”, fill out the information as I have it in my example image, make sure it is on the user you just made for the PS, and remember the “Web Directory” you set!
Connect to your subdomain you just set and use the user we setup earlier, in the hostname, simply enter your sub. Once you click “Open” the connection will start, enter the username you made earlier, then it will ask you for your password, enter that as well.
When done you will see a command prompt, type “ls” from there you should see a few folders, we want the one you made with the subdomain, so type “cd FOLDERNAMEHERE” to make it your current directory. From here, we install SRCDS (the engine that runs source servers), you can find the SRCDS tutorial on how to install here, for this tutorial I will also paste the instructions here.
chmod +x hldsupdatetool.bin
The new version of HLDSUpdateTool will be downloaded now. You will be returned to the console after its done.
|2) Downloading the files|
We can start downloading the files. This can take a few hours depending on the connection the server uses.
|./steam -command update -game “Counter-Strike Source” -dir .|
If you want to install a Half-Life 2 Deathmatch server, use “hl2mp” for the game switch. For Team Fortress 2, use “tf”.
Go get yourself a cup of coffee.
|3) Starting srcds|
First edit (or create) srcds_l/cstrike/cfg/server.cfg like you want it to be. Now we are ready to run the srcds.
./srcds_run -console -game cstrike +map de_dust -maxplayers 16 -autoupdate
and press enter. (-game hl2mp if it’s a HL2DM server ofcourse)
Your srcds is now up and running.
Now installing SRCDS is done! Lets make a auto-start script.
Without modifying or installing certain packages for nix, we cant use the screen script valve recommends in the install tutorial, for a stand-in I simply edited their use. Create a file either with command in shell or upload with FTP to your /srcds_1/orangebox directory, the file contents will be as follows:
screen -A -m -d -S server ./srcds_run -console -game tf +map ctf_2fort +maxplayers 32 -autoupdate -tickrate 100 +fps_max 500
Change this command line to your own needs, save as “start” and upload to the directory listed above.
Now in shell go to your orangebox directory
cd FOLDER (This represents the name you made in the subdomain, btw)
After that type ls to make sure the file “start” is there, if so enter the command
chmod +x start
then proceed to run the script with
Now that you have run the startup script, the server will start running.
NOTE: The best way to restart a server, or even stop it, is through the DreamHost control panel to restart your private server. (DH Only)
To find your server’s IP, in shell type the command
/sbin/ifconfig | less
You will then see your server’s IP listed next to “inet”
Congratulations, your successfully running a bare bones server off of a DreamHost PS!
If your server ever crashes, or doesn’t show up on server list, you can restart it by going into ssh (putty), from the root of your user make FOLDER/srcds_1/orangebox your current directory (As I explained above) and then type ./start for the server to restart.
This method has no logging for the server errors other than what is logged in files, you cannot see the actual command window. Its a very primitive way to run a server, but its much cheaper and works sometimes just as well, keep in mind that DreamHost is located in LA, Cali. Thus any server you host, while on a gigabit line, is a west coast server.
Working FTP with your server
Connect to your subdomain as the ftp address, aka for our training server:
User and password are same as the one for ssh (this is why we gave the user shell access!), from here have a ball. I will not explain how to install plugins and addons and all that, use google. The hard part is done, you can do the rest.
Thats really all you need for a basic server, recompiling kernels, plugins/addons, and other such things such as running a Control Panel for your server, you will have to figure out on your own, be prepared for some serious work in this adventure, if you so choose to go for it. Look out in the future for a basic Control Panel I am currently developing to run RCON in php for console, and to run scripts for restarting/editing server files. This panel will work on ANY web server running php 5. Again, not quite done with it, in the process of developing it for Anarchy 99.