Skip to main content

How to Create Your Counter-Strike 2 Server

This guide explains how to install and configure a dedicated Counter-Strike 2 (CS2) server on your VPS or dedicated Linux server.

Order a Server​

To host your Counter-Strike 2 server, HostMyServers offers several gaming-optimized options:

Prerequisites​

Resources

The resources listed below correspond to the server's requirements and do not take into account the resources already used by the operating system, installed software or other services present on the machine. Allow about 50 Mbps for 10 players or more.

  • SSH access as root or user with sudo privileges
  • 64-bit Linux system (Debian 12/13 or Ubuntu 22.04/24.04 recommended, glibc 2.31 or higher required)
  • Active firewall: nftables (recommended), iptables or ufw (use only one firewall tool at a time)
  • Minimum 4 GB RAM (8 GB recommended)
  • About 70 GB free disk space (100 GB recommended, SSD)
  • Port 27015 UDP accessible (and port 27015 TCP for RCON, from your static IP address only)
  • A Steam account with a registered phone number (for the GSLT token)

Required Configuration​

ComponentMinimumRecommended
RAM4 GB8 GB
CPU2 cores4 cores, high clock speed
Storage70 GB SSD100 GB SSD
Network100 Mbps1 Gbps
Network Protocol

Counter-Strike 2 uses port 27015 over UDP for the game and over TCP for RCON access (remote administration). The TCP port must only be accessible from your IP addresses (requires a static IP address).

Tickrate

Counter-Strike 2 uses the "subtick" system: there is no longer a -tickrate parameter to configure.

System Update​

sudo apt update && sudo apt upgrade -y

Installing Dependencies​

SteamCMD requires the 32-bit library lib32gcc-s1. Install the required packages:

sudo apt install -y wget tar screen lib32gcc-s1

Creating a Dedicated User​

For security reasons, create a dedicated user:

sudo adduser --disabled-password --gecos "" cs2

Firewall Configuration​

Open port 27015 over UDP for players. Port 27015 over TCP is used for RCON: restrict it to your static IP address (replace YOUR_IP).

With UFW​

sudo ufw allow 27015/udp
sudo ufw allow from YOUR_IP to any port 27015 proto tcp
sudo ufw reload

With iptables​

sudo iptables -A INPUT -p udp --dport 27015 -j ACCEPT
sudo iptables -A INPUT -p tcp -s YOUR_IP --dport 27015 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4

Saving the rules across reboots requires the iptables-persistent package.

With nftables​

These commands use the inet filter table and the input chain, which are present by default in /etc/nftables.conf on Debian.

sudo nft add rule inet filter input udp dport 27015 accept
sudo nft add rule inet filter input ip saddr YOUR_IP tcp dport 27015 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.conf
RCON Security

Never open TCP port 27015 to everyone: it gives access to RCON. Without a static IP address, do not open this port and use an SSH tunnel instead.

Installing SteamCMD​

Connect as the cs2 user:

sudo -u cs2 bash
cd ~

Create the directories and download SteamCMD:

mkdir -p ~/steamcmd ~/cs2-server
cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzf steamcmd_linux.tar.gz

Downloading the CS2 Server​

Start the server installation (application ID 730):

./steamcmd.sh +force_install_dir /home/cs2/cs2-server +login anonymous +app_update 730 validate +quit
Disk Space

With insufficient disk space, SteamCMD stops with the error state is 0x202 after update job (see the FAQ).

Tip

The download can take a while. If the installation stops with a network error, simply run the same command again: SteamCMD resumes where it left off.

At the end, the message Success! App '730' fully installed. is displayed. Check that the server executable is present:

ls ~/cs2-server/game/bin/linuxsteamrt64/cs2

Linking steamclient.so​

CS2 needs the steamclient.so file to communicate with Steam. Create the link to SteamCMD's 64-bit file:

mkdir -p ~/.steam/sdk64
ln -sf ~/steamcmd/linux64/steamclient.so ~/.steam/sdk64/steamclient.so

GSLT Token (required)​

GSLT Token Required

For your server to be listed among public servers and to accept connections from the Internet, you need a GSLT (Game Server Login Token). Without it, the server only works on the local network.

To generate it, log in to your Steam account and go to the Steam Game Server Account Management.

Creating the token has a few prerequisites:

  • Your Steam account must not be community banned or locked
  • Your Steam account must not be limited
  • Your Steam account must have a registered phone number
  • Your Steam account must own the game for which you are creating a game server account
  • Your Steam account can create up to 1000 game server accounts

In the App ID of the base game field, enter 730. You can add a memo to remind you which server it is for, then finish by clicking the Create button.

To use the token, add it to the launch command line:

+sv_setsteamaccount YOUR_TOKEN
Tip

Use one token per server and never share it. Add the parameter to all your launch lines: the first launch, the ExecStart line of the systemd service and the command run with screen.

Server Configuration​

server.cfg File​

Create the configuration file:

nano ~/cs2-server/game/csgo/cfg/server.cfg

Basic Configuration​

hostname "My CS2 Server"
sv_password ""
rcon_password "ChangeMe"
sv_region 3
sv_lan 0
sv_cheats 0
mp_friendlyfire 0
mp_autoteambalance 1
Security

Choose a long and unique rcon_password. Anyone who knows it can administer your server.

Main Parameters​

ParameterDescription
hostnamePublic server name
sv_passwordPassword to join (empty = public)
rcon_passwordRemote administration password
sv_regionRegion: 3 = Europe, 0 = US East, 4 = Asia, 255 = worldwide
sv_lan0 = server visible on the Internet, 1 = local network only
sv_cheatsCheat commands (0 = disabled)
mp_friendlyfireFriendly fire (0 = disabled, 1 = enabled)
mp_autoteambalanceAutomatic team balancing (0 or 1)

Game Modes​

The mode is selected at launch with +game_type and +game_mode:

Modegame_typegame_mode
Casual00
Competitive01
Wingman02
Arms Race10
Demolition11
Deathmatch12

First Launch​

cd ~/cs2-server/game/bin/linuxsteamrt64
./cs2 -dedicated -console -usercon -port 27015 -maxplayers 64 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount YOUR_TOKEN

Once startup is complete, the console shows the server connecting to the Steam servers. To stop the server, type quit.

Launch Optimization​

Launch Parameters​

ParameterDescription
-dedicatedRuns the server in dedicated mode (required)
-consoleRuns in console mode
-userconEnables RCON
-portServer port (27015 by default)
-ipIP address to listen on
-maxplayersMaximum number of players
+game_type and +game_modeGame mode (see the table above)
+mapgroupMap group (mg_active for the active official maps)
+mapStarting map
+sv_setsteamaccountGSLT token (required, see the dedicated section)
-insecureDisables VAC protection (see the warning below)
The -insecure Parameter

-insecure disables VAC protection: only use this parameter for testing, as it leaves the door open to cheaters.

Tip

Always leave 1 to 2 GB of RAM free for the operating system.

Changing the Port​

./cs2 -dedicated -console -usercon -port 27016 -maxplayers 64 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount YOUR_TOKEN

Don't forget to open the new port in the firewall.

File Structure​

PathDescription
game/bin/linuxsteamrt64/cs2Server executable
game/csgo/cfg/Configuration files
game/csgo/cfg/server.cfgMain configuration
game/csgo/addons/Extensions (Metamod, CounterStrikeSharp)

Configuration as systemd Service​

Create Service File​

Exit the cs2 user session (exit) to return to your administrator account, then create the service file:

sudo nano /etc/systemd/system/cs2.service

File content:

[Unit]
Description=Counter-Strike 2 Server
After=network.target

[Service]
Type=simple
User=cs2
Group=cs2
WorkingDirectory=/home/cs2/cs2-server/game/bin/linuxsteamrt64
ExecStart=/home/cs2/cs2-server/game/bin/linuxsteamrt64/cs2 -dedicated -console -usercon -port 27015 -maxplayers 64 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount YOUR_TOKEN
Restart=on-failure
RestartSec=20

[Install]
WantedBy=multi-user.target

Enable and Start Service​

sudo systemctl daemon-reload
sudo systemctl enable cs2.service
sudo systemctl start cs2.service

Management Commands​

# Check status
sudo systemctl status cs2.service

# Stop server
sudo systemctl stop cs2.service

# Restart server
sudo systemctl restart cs2.service

# View logs
sudo journalctl -u cs2.service -f
Server Console

With systemd, the server console is not interactive. To send commands, use RCON from the game or launch the server with screen (see below).

Running with screen (alternative)​

Single Launch Method

If the systemd service is running, stop it first (sudo systemctl stop cs2.service): two servers cannot use the same port.

sudo -u cs2 bash
cd ~/cs2-server/game/bin/linuxsteamrt64
screen -S cs2
./cs2 -dedicated -console -usercon -port 27015 -maxplayers 64 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount YOUR_TOKEN

To detach: Ctrl+A then D

To return: screen -r cs2

Run in the Background with a Log​

sudo -u cs2 bash
cd ~/cs2-server/game/bin/linuxsteamrt64
screen -AdmSL cs2 ./cs2 -dedicated -console -usercon -port 27015 -maxplayers 64 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +sv_setsteamaccount YOUR_TOKEN
OptionDescription
-AAdapts the window to the terminal size
-d -mStarts the session detached, in the background
-S cs2Session name
-LWrites the server output to a log file

The screenlog.0 file is created in the folder where the command is run (~/cs2-server/game/bin/linuxsteamrt64) and contains all the server-side output. To follow it live:

tail -f ~/cs2-server/game/bin/linuxsteamrt64/screenlog.0

In case of a startup error, this is the first file to check. To return to the server console: screen -r cs2

Tip

The screenlog.0 file grows with each launch. Remember to purge or delete it regularly.

Server Update​

Stop Server​

sudo systemctl stop cs2.service

Download the New Version​

sudo -u cs2 bash
cd ~/steamcmd
./steamcmd.sh +force_install_dir /home/cs2/cs2-server +login anonymous +app_update 730 validate +quit
exit

Restart Server​

sudo systemctl start cs2.service

Console Commands​

These commands are used in the server console or via RCON.

CommandDescription
statusShows connected players and their ID
map <map>Change map
kick <player>Kick a player
banid <minutes> <steamid>Ban a player (0 = permanent)
mp_restartgame 1Restart the game
say <message>Send a message to all players
exec server.cfgReload the configuration
quitStop the server

Using RCON from the Game​

Your IP address must be allowed on TCP port 27015 in the firewall.

In the game console:

rcon_address SERVER_IP:27015
rcon_password YourPassword
rcon status

Automatic Backup​

Backup Script​

sudo nano /home/cs2/backup.sh
#!/bin/bash
BACKUP_DIR="/home/cs2/backups"
SERVER_DIR="/home/cs2/cs2-server"
DATE=$(date +%Y-%m-%d_%H-%M-%S)

mkdir -p $BACKUP_DIR

# Backup the configuration
tar -czf $BACKUP_DIR/cs2_$DATE.tar.gz -C $SERVER_DIR game/csgo/cfg

# Delete backups older than 7 days
find $BACKUP_DIR -name "cs2_*.tar.gz" -mtime +7 -delete

echo "Backup completed: cs2_$DATE.tar.gz"
sudo chown cs2:cs2 /home/cs2/backup.sh
sudo chmod +x /home/cs2/backup.sh
Tip

If you install extensions, add game/csgo/addons to the tar command.

Schedule Backup​

sudo crontab -u cs2 -e

Add:

# Backup every day at 4 AM
0 4 * * * /home/cs2/backup.sh

Connecting to the Server​

Players can connect by:

  1. Launching Counter-Strike 2
  2. Opening the game console (enabled in the game options)
  3. Typing: connect SERVER_IP:27015
  4. If a password is set: password YourPassword before connecting

You can also add the server to your Steam favorites (View menu, Servers, Favorites tab).

Troubleshooting​

Server won't start​

  • Check the logs: sudo journalctl -u cs2.service -n 100
  • Check the available disk space: df -h
  • Check that the installation is complete (re-run the app_update command)
  • Check that the executable exists: ls ~/cs2-server/game/bin/linuxsteamrt64/cs2 (otherwise, the installation is incomplete)
  • Check that the steamclient.so link exists: ls -l ~/.steam/sdk64/steamclient.so

Players can't connect​

  • Check that the GSLT token is present and valid in the launch command line

  • Check that port 27015 is open over UDP:

    sudo ufw status
    sudo iptables -L INPUT -n --line-numbers | grep 27015
    sudo nft list ruleset | grep 27015
  • Check that the server is listening: ss -ulnp | grep 27015

  • Test from another machine with nc -zvu SERVER_IP 27015

Server doesn't appear in the list​

  • Check that sv_lan 0 is set in server.cfg
  • Check that the GSLT token is valid: if in doubt, generate a new one
  • Wait a few minutes after startup
  • Check that the server has Internet access

Performance issues​

  • Reduce -maxplayers if the server is overloaded
  • Disable unnecessary extensions in game/csgo/addons
  • Schedule regular restarts

FAQ​

I get the error "Error! App '730' state is 0x202 after update job"​

This error is usually caused by a lack of disk space: the CS2 installation takes about 69 GB, and the error was observed with only 50 GB available. Check the free space with df -h, free up space or add a volume, then re-run the app_update command.

Which ports need to be opened?​

In addition to the server port (27015 over UDP), these ports are required by Steam. They allow the server to receive responses from Steam servers when your firewall blocks incoming traffic by default:

UFW:

sudo ufw allow proto udp from any port 27000:27030 to any port 1025:65535
sudo ufw allow proto udp from any port 4380 to any port 1025:65535
sudo ufw reload

iptables:

sudo iptables -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65535 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --sport 4380 --dport 1025:65535 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4

nftables:

sudo nft add rule inet filter input udp sport 27000-27030 udp dport 1025-65535 accept
sudo nft add rule inet filter input udp sport 4380 udp dport 1025-65535 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.conf

I get "Permission denied" when running ./steamcmd.sh​

Apply a chmod:

chmod +x /home/cs2/steamcmd/linux32/steamcmd && chmod +x /home/cs2/steamcmd/steamcmd.sh

I get the message "WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'"​

This is not a real problem: only some international characters may display incorrectly. To fix it:

sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8

If the locale-gen command is not found, first install the locales package with sudo apt install -y locales.

I get a ulimit error (no permission / can not open file)​

Set the open files limit to 2048, the value recommended by Valve. For the current session, before launching the server:

ulimit -n 2048

With systemd, add this line to the [Service] section of the service file, then reload and restart:

LimitNOFILE=2048
sudo systemctl daemon-reload
sudo systemctl restart cs2.service