Installing a CS:GO Dedicated Server in Ubuntu
Believe it or not, Counter-Strike Global Offensive is at the height of its entire timeline. This 8-year-old game, that some people prophesied to be dead soon, keeps chugging on. It had an influx of new players when the game was made free at Steam Store. And during the corona lockdown, CSGO is breaking its own maximum concurrent player record every day. And I for one, been playing CSGO for the last 6 years. I am not looking to be a pro player or win tournaments, I just wanna play with friends and have fun.
Coming back to the topic at hand, why do you wanna install a CSGO Dedicated Server? Your reason might be different from mine, but the gist comes down to control and openness. A contradictory statement, but let me explain.
In my Online Games friend circle, we have more than 5 people playing CSGO at a time. Which makes it harder for all of us to play together. CSGO Official Matchmaking supports up to 5 people in a lobby. Leaving others to play on their own, which kinda leaves a bad vibe. So we decided, we need a CSGO server for ourselves. We can play against each other. We can Invite other teams to play against us and have some fun all together.
Before Jumping In
CSGO is a processor-heavy game. Being a precision first-person shooting game, it takes a lot of calculation to do the things you do in gameplay. This means, wherever you wanna put your Dedicated Server in, it needs to have a solid CPU to push out all the frags and headshots you are deemed to achieve.
This “Tutorial” is focused on my specific workflow, how I want to set everything up. You shouldn’t have any problem replicating this in any Ubuntu Server or Desktop Installation.
However, I will be adding a few mods at the end to make the server more team and community-friendly, you can skip those if you want.
Requirements
I am not a Server Administrator myself, all my experience comes from being a long time Linux user. Bear with me if you find something that could be done more efficiently, easily.
At this point, I am assuming you have Ubuntu Installation ( Either Server or Desktop Edition ). I will be doing the whole installation by SSHing into a Remote Server. If you are running this setup at your own computer, you can use the terminal to follow along. Since you are looking into building a CSGO dedicated server, I assume you already have a Steam Account and CSGO Installed on your Computer, Duh!
I also assume you know the basics of how to use Linux Shell or Terminal. I am not gonna get into how to install Ubuntu or how to set up your SSH Keys. Hopefully, you already got those down and done.
We start from where you have a Ubuntu installation.
The Start
The first order of business is to get everything updated. Go ahead and do the updates,
apt update && apt upgrade
Let's do a quick reboot.
systemctl reboot
Wait for a few seconds to let it reboot, then lets log back in.
One more thing that will come in handy later on is a Terminal based text editor. I prefer to use “nano”, but if you are a VIM user, all the more power to you. If you are installing this on a personal computer, this step isn’t necessary. For a remote setup, this might help you in a pinch.
apt install nano
If you have Multiverse Repositories enabled in Ubuntu, you can skip to the Steam CMD installation part.
Let's get Multiverse Repo’s enabled. Run the following commands,
apt install software-properties-common
Then,
add-apt-repository multiverse
That will enable the multiverse component. Next, we need to add the 32bit support. Why? Let’s not get into it, otherwise, this post will never finish.
dpkg --add-architecture i386
And then, run another update,
apt update
SteamCMD
The Developers over at Valve Software actually done something truly awesome with Steam Command line client or Utility.
# https://developer.valvesoftware.com/wiki/SteamCMD
Let's get that installed.
apt install steamcmd
It will show a screen to accept the license agreement.
Hit Enter, it will show you another screen.
Use the arrow key to select “I AGREE” and hit enter. SteamCMD should be installed at this point in a few secs.
User for CSGO
We are going to create a user for CSGO that will initiate the server process. Running the CSGO Server as root isn’t recommended and highly discouraged for security reasons.
adduser --gecos "" --disabled-login csgo
With this command, we are adding a user that doesn’t have a password by default and the --gecos
tag will let us add this user without providing any information for the user. You can type man adduser
for more details.
Finally, let’s install the server
We are ready to install the server. First, we need to log on as the new user we created.
su - csgo
Now, using SteamCMD, we will download CSGO do some adjustments.
steamcmd +force_install_dir ~/csgo-ds/ +login anonymous +app_update 740 validate +quit
Let's explain what we are doing here a bit.
steamcmd
is the command line steam client. Using +force_install_dir
parameter we are asking the client to install CSGO ~/csgo-ds/
directory. +login
is the login flag, where we are logging anonymously to steam. +app_update
is telling steam which app/game we are downloading. In the case of CSGO, the App ID is 740. validate
is basically asking it to validate the downloaded files once the download is done. The last one is easy to understand, I believe.
Depending on the time you are doing this, steamcmd may download some updates and then start downloading CSGO. It's a big file, so wait until the download process is finished.
128 Tick
We will be building a 128 Tick CSGO Dedicated Server. Yes, I know its a polarized topic in the CSGO community. Some people favor 64 ticks, while others want Valve to update all the CSGO Servers to 128 Tick. I am not gonna get into what is better and why. The correlation between tick speed and framerate is a mathematical one, opinions don’t matter here.
Game Server Login Token
The Steam Game Server Login Token or in short, GSLT is how steam knows about the server, lets it login and use steams services. Get your GSLT Token Here. The App ID should be 730, instead of 740. The Memo is something you write down to remember which server that specific token belongs to, in case you have multiple.
There are certain rules regarding managing and maintaining a server. You must follow those rules or risk getting your server banned.
Nitty-Gritty before moving on
In a case like mine, when you are running it on a remote server, you have to do everything from a terminal, mostly. When you start the game, the console stays open in the terminal and if you terminate the terminal, it shuts the game server down. We don’t want that, we don’t want to keep the terminal open forever also.
Enter Tmux or Screen. Whichever you are comfortable with. Tmux is newer and more feature-rich, while screen is vintage ( 33 years old to be exact )but good enough.
Both of them let you run multiple terminal instances from one terminal window. You open a new terminal instance, do something and go back to your main. The new one will remain open in the background, doing whatever task you have running on it. This is a very simplified explanation, but it should get you started.
Let's log out of the csgo
user and go back to the root using exit
command.
Install Tmux,
apt install tmux
And log back into our csgo user. You know how ;)
Launch tmux by tmux
command.
We should have a clean terminal window now.
Launching the Server
Finally, we are at the point where we can launch the server.
~/csgo-ds/srcds_run -game csgo -net_port_try 1 +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
The last “AAA….” part is where your GSLT will go, just after the +sv_setsteamaccount
flag.
This is a test launch, for you to see if everything working properly. If there no unexpected error, in the end, it should pop out your server’s Public IP and say its VAC Secure.
If you are at this point, congratulation, you just installed a dedicated CSGO server in a Ubuntu Installation.
But we are not done
CSGO Server has a lot of configurable options you can integrate into different points. Check out their official Wiki page to know more details.
Anything we are doing at this point is to make our life easier by automating a few things. Lets shut the server down first. Type csgo
into the running csgo console and it should shut the server down.
Game Mode
I will be running a classic competitive mode in csgo. That becomes in the start command +gamemode 0 +gametype 1
.
Map group
CSGO has multiple Map Cycle or map group as they are called. Active Group is the map pool that CSGO pro matches will happen. And in the start command, you can define which map you want the server to start with.
+mapgroup mg_active +map de_mirage
That sets the server to cycle through the Active Map group and start with my favorite map, Mirage.
Additional Flags
-tickrate 128
You can pretty much guess what this one does.-nobots
stop bots from joining games.
Full Startup Command
~/csgo-ds/srcds_run -game csgo -usercon -net_port_try 1 -tickrate 128 -nobots +game_type 0 +game_mode 1 +mapgroup mg_active +map de_mirage +sv_setsteamaccount AAAAAAAAAAAAAAAAAAAAA
N.B: if you are looking at tutorials somewhere else, you might see a -console
tag attached to this command, that's specifically for windows servers. For Ubuntu or any Linux distro, you won’t be needing it.
The .CFGs
Like I said before, CSGO Server is insanely configurable. And all those configurations start with two basic files,
- server.cfg
- autoexec.cfg
autoexec.cfg
This file will be executed when the server starts up. It will contain details about your server and anything you want to set as default in the game.
This file doesn’t exist by default. You can create it and edit it at the same time with the following command,
nano ~/csgo-ds/csgo/cfg/autoexec.cfg
This will create the file and open up a window for you to write your startup settings.
I am not gonna get into what you can put here, that's too big of a list to cover in an already huge post. You can find those here. Plus around the internet.
Since we are doing a 128 Tick server, add these two lines here too,
sv_minupdaterate 128
sv_mincmdrate 128
server.cfg
This file will be loaded every time there is a new map getting loaded into the server. Anything you want to apply to each match individually can be put here. Things like Auto Team Balance, Limiting team, logging players ID, etc.
nano ~/csgo-ds/csgo/cfg/server.cfg
Pretty much the same thing. Here is a basic example of a few things i write here,
Lets Automate
This isn’t in your traditional sense of automation. This is more in the line of shortcuts.
Let's create a Shell Script at the root of your csgo user from the root user.
nano ~/home/csgo/startcsgo.sh
In the file, do something like this. You are free to customize this as you like, this is basically how i make the shortcut.
#!/bin/shYOUR_GSLT=AAAAAAAAAAAAAAAAAAAAAAAAAAACSGO_INSTALL_LOCATION=~/csgo-ds/cd $CSGO_INSTALL_LOCATION./srcds_run -game csgo -usercon +game_type 0 +game_mode 1 +mapgroup mg_active +map de_mirage -tickrate 128 +sv_setsteamaccount $YOUR_GSLT -net_port_try 1 -nobots
Save it and make it executable ( from root user ). Now every time you start the server, you can use this script to start it.
./startcsgo.sh
You don’t have to fiddle around the configurations anymore to find everything or copy-paste it from somewhere.
We are gonna make another file, to update the game when Valve releases a new update.
nano ~/home/csgo/updatecsgo.sh
Put the following lines,
#!/bin/shsteamcmd +force_install_dir ~/csgo-ds/ +login anonymous +app_update 740 +quit
Save it, make it executable. Run this when there is a new update in csgo and you need to update the server.
I will be writing another post that involves SourceMod and MetaMod. Perhaps WarMods too. And another post concluding the saga about how to maintain the server properly. This post has been weeks in the writing and thanks to you for reading.
Feel free to leave a response if you have any questions. Clap if this was useful for you.