Tutorials

Counter-Strike 2 Server

Counter-Strike 2 is one of the most popular competitive shooters. Running your own server lets you host private matches, practice sessions, or community servers. This guide assumes you have already installed SteamCMD.

Requirements

1. Install the Server

su - steam
cd ~/steamcmd
./steamcmd.sh +force_install_dir ~/cs2 +login anonymous +app_update 730 validate +quit

2. Get a Game Server Login Token

Go to Steam Game Server Account Management and create a token for App ID 730. You need a Steam account with CS2 in your library.

3. Configure the Server

Create a start script:

nano ~/cs2/start.sh
#!/bin/bash
cd /home/steam/cs2

./game/bin/linuxsteamrt64/cs2 \
  -dedicated \
  -port 27015 \
  -console \
  -usercon \
  +game_type 0 \
  +game_mode 1 \
  +mapgroup mg_active \
  +map de_dust2 \
  +sv_setsteamaccount YOUR_GSLT_TOKEN \
  +sv_lan 0
chmod +x ~/cs2/start.sh

Common game modes:

game_type game_mode Mode
0 0 Casual
0 1 Competitive
1 0 Arms Race
1 2 Deathmatch

4. Create a systemd Service

Exit back to root:

nano /etc/systemd/system/cs2.service
[Unit]
Description=Counter-Strike 2 Server
After=network.target

[Service]
User=steam
WorkingDirectory=/home/steam/cs2
ExecStart=/home/steam/cs2/start.sh
Restart=on-failure
RestartSec=15
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable cs2
systemctl start cs2

5. Open Firewall Ports

Open the following ports in the Sitequest firewall:

Port Protocol Purpose
27015 TCP/UDP Game traffic and queries
27020 TCP RCON (optional)

With ufw:

ufw allow 27015
ufw allow 27020/tcp

6. Connect

In CS2, open the console (~) and type:

connect YOUR_SERVER_IP:27015

Or add your server to favorites in the Steam server browser.

Next Steps

  • Set an RCON password for remote administration: +rcon_password YOUR_PASSWORD
  • Configure server.cfg in game/csgo/cfg/ for round times, friendly fire, etc.
  • Install MetaMod/CounterStrikeSharp for plugins
  • Add custom maps via Workshop collection IDs