CounterStrike has always been enjoyable to play from time to time. I have had a CS 1.6 server in the past, but it was time to stand up a CS:GO server. There are many steps available online to walk through this process, however they all seem to lack the end to end setup to share your private server with the community at large. Once we outline those missing steps, we will cover how to make this into a properly functioning server.
I will direct you to one of many links to show an option for setting up a CS:GO server in Ubuntu. There are many that follow various tutorials along the same concept. As it is not all inclusive, the intent of this post is to help a server install cross the finish line.
This server is currently running within VMware on Ubuntu 14.04. It has 1 CPU, 4GB of RAM, and a 64GB hard drive.
Base CS:GO Application
The first key thing to keep in mind is file ownership permissions. You do NOT need to sudo to launch steamcmd.sh or initiate the server. These folders should be owned by a non-root (i.e. your administrative login). To own the files, simply browse to the main steam directory and issue:
sudo chown -R <username>:<username> *
A second, arguably less important item to keep in mind is the installation location. Some directions would suggest you to install the game into your user directory at /home/<username>/steam. I disagree with this approach if you are going to use it as a server. I personally extracted/installed the application into the /usr/share/steam directory. If this is intended as a heavily used server, consider partitioning off the installation to protect the core operating system.
Base Network Configuration
Inbound ports in the video example are completely overkill. There are three ports that need opened inbound to the server:
udp/27015 (Server default port)
tcp/27015 (Optional: Match server port on TCP protocol if desired Remote Console)
udp/27012 (Steam control port)
One thing that was missing in many of the documented procedures was the remote console (rcon) setup. Not only do you need a parameter on the startup string, but you need a port open.
There are many outbound initiated ports that would already be open if you play CS:GO already. Many of these are in the 27000 range and vary between TCP and UDP. Most home networks do not block outbound connections (only inbound) so most folks should be good to go here.
Startup Parameters
There is an essential startup parameter that always is left out. It is extremely irritating as it completely blocks the remote players from connecting. You must differentiate your private IP that is actually on the server and your public IP that will be advertised into Steam’s server database. To do this, we need to add two separate parameters to the startup string.
This parameter uses the IP address of 192.168.2.15 associated with this server. This IP must exist on the server hosting the CS:GO application. Pretty much every tutorial has this parameter, but fails to mention the intent.
-ip 192.168.2.15
This parameter is used for the Steam database to advertise to the remote world. Without this, your server will tell the world that your server on a private/RFC1918 address. This is the often missed key parameter to allow remote clients to access your server.
+net_public_adr 24.210.27.246
And for the complete script that is running counterstrike.destephen.com:27015, please see below:
./srcds_run -game csgo +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 -ip 192.168.2.15 +net_public_adr 24.210.27.246 +port 27015 -condebug -tickrate 128 -usercon
To break the command down:
./srcds_run \\ Command to initiate the server launch. Do not use srcds_linux!
-game csgo \\ We are running CounterStrike Global Offensive
+game_type 0 \\ Game type outlined here, but this is a Community Competitive server
+game_mode 1 \\ Game mode outlined here, but this is a Community Competitive server
+mapgroup mg_active \\ Selects the map group for Active Servers.
+map de_dust2 \\ Starting map
-ip 192.168.2.15 \\ Internal IP that exists on server
+net_public_adr 24.210.27.246 \\ Your Public IP
+port 27015 \\ Your UDP port to host the server on
-condebug \\ Enables console output to log to ./csgo/console.log
-tickrate 128 \\ Enables 128 tick server
-usercon \\ Enables remote console (don’t forget the TCP port requirements!)
With the above commands on top of a standard guide, you should be able to start your CS:GO server successfully.
Making it a Server!
AutoStart the CS:GO Server
What good is having a server if you have to manually start the application after each reboot?
First, we need to add a few packages. We will want to add Webmin to easily manage the startup processes (bad habit, I know). With Webmin installed, we can configure our CS:GO server to start automatically on startup. To do this, we will want to create an extremely simple script. Our script below is only two lines.
localadmin@counterstrike:/usr/share/steam$ cat csgo-27015.sh #!/bin/bash /usr/share/steam/csgo/server27015/./srcds_run -game csgo +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 -ip 192.168.2.15 +net_public_adr 24.210.27.246 +port 27015 -condebug -tickrate 128 -usercon localadmin@counterstrike:/usr/share/steam$
It is also recommended to reference your script with the absolute path names. There has been reports that some updates in the past broke “~” directory references.
Once the script is saved with your favorite editor, we need to make it executable.
chmod +x csgo-27015.sh
Now we can create a new upstart script in our Webmin interface to launch the server at start. Once logged into Webmin, browse to System -> Bootup and Shutdown. We need to create a new upstart service:
Next, we want to use the following parameters to reference our newly created script. The “Server program and parameters” is the directory reference to were we created our script.
After a server reboot, our server should automatically start.
Logging the Server
Next task at hand for my setup was to log all the output into the console.log into a Cacti syslog database. To do this, I use syslog-ng. The following edits were added to /etc/syslog-ng/syslog-ng.conf:
source s_src { system(); internal(); file("/usr/share/steam/csgo/server27015/csgo/console.log"); };
# Counterstrike Server Logging destination d_csgo-27015 { file("/usr/share/steam/csgo/server27015/csgo/console.log"); udp( "192.168.0.74" port (514));};
The first section identifies the console.log file as a source whereas the second section sends the file to the Cacti server.
Monitor the Server
Using snmpd, the server was setup in Cacti. Standard Linux server monitoring allows me to track the CPU, memory, and network utilization amongst other items.
As you can see from the network utilization, the upload use can be quite heavy. Never a bad idea to help prioritize with QoS :).