;

How to install Counter-Strike: GO server on Ubuntu 14

Try it in our public cloud & Get $5 Credit
CLAIM NOW

How to install Counter-Strike: GO server on Ubuntu 14

The fourth installment of the popular franchise Counter-Strike, called Counter-Strike: Global Offensive, is one of the few first person shooters available to Linux users. Accordingly, your Linux box is an excellent candidate to host a server for Counter-Strike: GO. With our guide, you can make installation a painless, error free process.

Getting started

Before proceeding with the steps in this guide, make sure you have the following:
• 1 Node (Cloud Server or Dedicated Server) running Ubuntu 14.
• Root access to the node.
• All system updates applied
• Tar, nano, and wget, which should be included in the base Ubuntu installation already
• lib32gcc1

Tutorial

Your first step is to make sure that your system is up to date.
apt-get update && apt-get upgrade -y

We’ve prepared the following commands for you to run on your Ubuntu 14.04 LTS server.
apt-get install nano wget tar lib32gcc1 -y

You will need to create a user for Steam.
adduser --disabled-login --disabled-password steam

Feel free to leave the info fields empty, as they aren’t necessary. At the end of the process, validate the information by pressing Y or Enter.

Next, we’ll proceed with the steps for installation. Enter the Steam command shell:

cd /home/steam/
su - steam
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar xvf steamcmd_linux.tar.gz
rm steamcmd_linux.tar.gz
./steamcmd.sh

Once you’re in the shell, issue this command:

login anonymous
force_install_dir ./csgo
app_update 740 validate

Now wait for the server software to download and be installed. You should see this message when everything’s done.

Update state (0x61) downloading, progress: 100.00 (15789214502 / 15789238956)
Success! App '740' fully installed.

All that remains is to type quit to exit the shell.

For WAN connections, Counter-Strike: GO will require a server token. (If you’re just running over LAN, this won’t be necessary.) Naturally, you’ll need to have a Steam account and own a copy of Counter-Strike:GO.

For more information on the Game Server Login Token, be sure to consult Valve’s Counter Strike: GO wiki. Here’s an extract of the pertinent information:

Registering Game Server Login Token

CS:GO game servers and GOTV relays not logged in to a persistent game server account with a Game Server Login Token (GSLT) will only allow clients to connect from the same LAN RFC1918 addresses (10.0.0.0-10.255.255.255,172.16.0.0-172.31.255.255,192.168.0.0-192.168.255.255). If your server has a public routable IP address and clients need to connect from outside the server LAN then you need to get registered for GSLT.

To create your GSLTs, visit the GSLT creation utility and follow the instructions here: http://steamcommunity.com/dev/managegameservers

Each GSLT is restricted for use on one dedicated server instance only, and should be passed on command line with +sv_setsteamaccount THISGSLTHERE. You can also use command line setting -net_port_try 1 to avoid instances from reusing the same GSLT by accident.

Every game server operating with your GSLT must comply with game server operation guidelines outlined here: http://blog.counter-strike.net/index.php/server_guidelines/

Follow this link: http://steamcommunity.com/dev/managegameservers and log in with the Steam account that has access to your copy of Counter Strike: GO.

You’ll see a form to fill in. Here’s the information that you’ll need to supply:
App ID: 730 (Be sure to type 730 here, and not 740 as you did in the Steam command line earlier!)
Memo: This is an optional description that you can use for your own purposes.

After validation, you’ll recieve your token.

Game Authentification token (GSLT) Last connection Memo
730 *********************************

Let’s move on to server configuration and your startup script. You will need to first create the server configuration file.
nano /home/steam/csgo/csgo/cfg/server.cfg

Open the file and add this content to it.

hostname "SERVER-HOSTNAME"
sv_password "SERVER-PASSWORD"
sv_timeout 60
rcon_password "RCON-PASSWORD"
mp_autoteambalance 1
mp_limitteams 1
writeid
writeip

hostname "SERVER-HOSTNAME" #This is the name of your server
sv_password "SERVER-PASSWORD" #This is your server password. You can leave it blank for no password.
rcon_password "RCON-PASSWORD" #This is your Rcon server password, if you'd like to administrate your server remotely via Rcon.

You’ll need to enter the following commands as your root user. Create a startup script that will automatically start Counter-Strike: GO if the server reboots. The script will be stored in this file:

nano /etc/init.d/csgo

Add the below content to the file, being sure to replace [YOUR_GSLT] in the script with your actual game server token.
!/bin/sh -e
DAEMON="/home/steam/csgo/srcds_run"
daemon_OPT="-game csgo -console -usercon +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount [YOUR_GSLT] -net_port_try 1"
DAEMONUSER="steam"
daemon_NAME="srcds_run"
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
d_start () {
log_daemon_msg "Starting system $daemon_NAME Daemon"
start-stop-daemon --background --name $daemon_NAME --start --quiet --chuid $DAEMONUSER --exec $DAEMON -- $daemon_OPT
log_end_msg $?
}
d_stop () {
log_daemon_msg "Stopping system $daemon_NAME Daemon"
start-stop-daemon --name $daemon_NAME --stop --retry 5 --quiet --name $daemon_NAME
log_end_msg $?
}
case "$1" in
start|stop)
d_${1}
;;
restart|reload|force-reload)
d_stop
d_start
;;
force-stop)
d_stop
killall -q $daemon_NAME || true
sleep 2
killall -q -9 $daemon_NAME || true
;;
*)
echo "Usage: /etc/init.d/$daemon_NAME {start|stop|force-stop|restart|reload|force-reload|status}"
exit 1
;;
esac
exit 0

If you’re looking for more information about game mode and game settings, check out Valve’s wiki page on starting the server.

We’ll need to make the script executable.
chmod +x /etc/init.d/csgo

Then, enable your Counter-Strike: GO Server to start on boot.
update-rc.d csgo defaults

Start up the server.
/etc/init.d/csgo start

The final step is to edit your firewall so Counter-Strike: GO traffic can flow to and from your server. If you are using Ubuntu’s default firewall service, iptables, here is how to open your ports both for Steam services & the Counter-Strike: GO server.
iptables -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65355 -j ACCEPT
iptables -A INPUT -p udp -m udp --sport 4380 --dport 1025:65355 -j ACCEPT

The ports that you’re allowing will carry this traffic:
• 27000 to 27015 inclusive: UDP Game client traffic
• 27015 to 27030 inclusive: UDP Typically Matchmaking and HLTV
• 4380 : UDP Steamworks P2P Networking and Steam Voice Chat

And if you’re using the iptables-services package, make sure to add this set of rules to your iptables file.
-A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65355 -j ACCEPT
-A INPUT -p udp -m udp --sport 4380 --dport 1025:65355 -j ACCEPT

Conclusion

Get ready to play Counter-Strike: GO on your newly launched server. Be sure to invite your friends, and to share this article with them if they’re interested in setting up their own server