1 Select your distribution (OS)
While there are various distributions of Linux available through the control panel, it may be difficult to know which one to pick. Gentoo is one of the most customizable distributions out there, but for a first time user, or even someone with moderate experience, it can be daunting, so it's not recommended here. CentOS is widely used, but is not very good for game servers because of the default kernel settings, which provide poor performance. For these reasons, we will be going with the latest release of Debian, although if you have a preference for Ubuntu, that would also be comparable. Keep in mind, the steps that are being shown here should be very close for all distributions, with only minor differences.
2 Configure the OS
We will be using a utility called screen that enables you to run interactive applications inside a separate console window that doesn't close when you disconnect from your terminal.
First, to update the packages list type
Code: Select all
apt-get updateCode: Select all
apt-get upgradeCode: Select all
apt-get install screenCode: Select all
dpkg --add-architecture i386
apt-get update
apt-get install lib32z1 libncurses5:i386 libbz2-1.0:i386 lib32gcc1 lib32stdc++6 libtinfo5:i386 libcurl3-gnutls:i386Create the new user account
Code: Select all
adduser steamGame servers need to have good timers to run off of, so it is important to run them as a higher priority than other system processes. Chrt is a preinstalled package that provides a way to do this.
Edit the limits.conf file
Code: Select all
nano /etc/security/limits.confCode: Select all
steam - rtprio 20Now we will log into the new account we created earlier. Log out of the root account by typing exit. To sign in on the user, you will change the account name from root to steam.
3 Installing Steam and the Source engine game
Create a folder for Steam
Code: Select all
mkdir steam-serverCode: Select all
cd steam-serverCode: Select all
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gzCode: Select all
tar xzvf steamcmd_linux.tar.gzCode: Select all
./steamcmd.shCode: Select all
force_install_dir /ssd/servers/tf2Code: Select all
force_install_dir /home/steam/servers/tf2Code: Select all
login anonymousIn this case, we are setting up a TF2 server, so the ID is 232250, so we run this command
Code: Select all
app_update 232250 validateNow to close the Steam installer, type quit.
4 Creating the startup script
To run the server, a script is needed.
Code: Select all
nano tf2-startup.shCode: Select all
chrt -r 20 /home/steam/servers/tf2/./srcds_run -game tf -ip xxx.xxx.xxx.xxx +maxplayers 24 -console -nocrashdialogThen save and close the script.
In order to let the system know that the script is allowed to be run, the file permission must be adjusted.
Code: Select all
chmod +x tf2-startup.shFinally we are ready to run the server. We will open it inside a screen so that it always runs.
Code: Select all
screen -S TF2Time to run the server.
Code: Select all
./tf2-startup.shTo detach from the screen and allow it to run in the background, press Control-a-d. If you want to reattach to the screen to check the console, type screen -r TF2. If you need to pause or scroll up a screen window, you can press Control-a and then press Escape once. Then you may arrow up to view logs higher up that may have disappeared off the window. To get out of this mode, press Escape again.
