How to Host a Counter-Strike: Global Offensive Server on Linux (CentOS)

In this tutorial, I’m using a dedicated server running CentOS to host a Counter-Strike: Global Offensive server.

Install the necessary packages.

yum -y install libgcc.i686 screen wget

Create a directory for the CSGO server.

mkdir ~/csgo ; cd ~/csgo

Retrieve and extract SteamCMD.

wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz

Run SteamCMD.

./steamcmd.sh

The program will update itself and you’ll be brought to a Steam prompt. For CSGO, you can just login anonymously.

login anonymous

Next, set the installation directory and let SteamCMD start downloading all of the necessary files. (Make sure you specify an absolute path)

force_install_dir /home/<user>/csgo/game/
app_update 740 validate

That part will take a while. After it’s complete, you’re ready to run your server.

~/csgo/game/srcds_run

But there are a few things you should do first.

1. Create a server.cfg file

vi ~/csgo/game/csgo/cfg/server.cfg

I only bother configuring a few settings, and leave all other cvars at their default values.

hostname "sample hostname"
rcon_password "samplepassword"

2. Decide what kind of variables you want to pass to srcds_run.

For example:

~/csgo/game/srcds_run -game csgo +ip 192.168.1.150 -port 27015 +map cs_office -secure

I just put that code above into a script and then execute it inside of a screen session, disconnect from the screen, and start playing.

screen -S csgo ~/start-server.sh

Ctrl + A, D to disconnect from screen.

Connecting to your server

You can open the developer console and connect to your server via IP address with this command:

connect x.x.x.x

Remember to forward port 27015 on your router.

Final Notes

You may get an error like this if you try to launch the server from some directory other than where it’s installed:

ERROR: Source Engine binary './srcds_linux' not found, exiting
Tue May 6 19:20:58 PDT 2014: Server Failed

It makes no sense. At all. But, you have to launch the server from the game directory itself. In short, make sure you have a cd command before your srcds_run line in your script. For example:

start-server.sh:

#!/bin/bash
cd ~/csgo/game
./srcds_run -game csgo +ip 192.168.1.150 -port 27015 +map cs_office -secure