Counter-Strike 2 is Valve's competitive first-person shooter. You can host your own dedicated server on Linux, allowing friends or the public to join custom matches with your own configuration.
Prerequisites
- A Linux VPS (Ubuntu 20.04 LTS or later recommended)
- SteamCMD installed (see Install SteamCMD on Linux for setup)
- At least 10 GB of free disk space
- Ports 27015–27030 (UDP/TCP) open in your firewall/security group
Step 1: Download Counter-Strike 2 server files
Log in as the steam user and download the server binaries. Counter-Strike 2's app ID is 730:
su - steam
cd ~/steamcmd
./steamcmd.sh +login anonymous +app_update 730 validate +quit
This downloads about 30–40 GB. Wait for the download to complete; you'll see "Success!" when done.
Step 2: Verify the installation
Check that the server files are present:
ls -la ~/Steam/steamapps/common/CS2/
You should see directories like game, bin, and files like gameinfo.gi.
Step 3: Create the server configuration directory
Game settings live in a config file. Create and edit it:
mkdir -p ~/Steam/steamapps/common/CS2/game/csgo/cfg
nano ~/Steam/steamapps/common/CS2/game/csgo/cfg/server.cfg
Paste a basic configuration:
hostname "My Counter-Strike 2 Server"
sv_password "changeme"
rcon_password "secure_rcon_password"
sv_lan 0
sv_region 4
mp_timelimit 45
mp_maxrounds 30
mp_warmuptime 60
sv_cheats 0
exec banned_user.cfg
exec banned_ip.cfg
Adjust these settings as needed. Save with Ctrl+X, then Y, then Enter.
Step 4: Open firewall ports
Open the required ports for gameplay. Run this from your main user account (not steam):
sudo ufw allow 27015:27030/udp
sudo ufw allow 27015:27030/tcp
sudo ufw reload
If using AWS/Azure/DigitalOcean security groups instead, add inbound rules for those port ranges from 0.0.0.0/0.
Step 5: Start the server
From the steam user account, launch the server:
cd ~/Steam/steamapps/common/CS2/game/bin/linuxsteam64
./cs2 -dedicated +exec server.cfg +map de_dust2 +sv_lan 0
You should see server startup messages. Once you see "Server is ready to accept connections", the server is running.
Step 6: Connect and test
On your personal PC:
1. Open CS2
2. Go to Community → Offline with Bots → Create Server
3. In console, type: connect your-server-ip:27015; password changeme
Replace your-server-ip with your VPS IP address.
Running the server in the background
Use screen or tmux to keep the server running after you disconnect:
screen -S cs2-server
cd ~/Steam/steamapps/common/CS2/game/bin/linuxsteam64
./cs2 -dedicated +exec server.cfg +map de_dust2 +sv_lan 0
Detach with Ctrl+A, then D. Reattach later with screen -r cs2-server.
Tips and Notes
- Map rotation: Add more maps to your config with lines like
+map de_infernoinstead of+map de_dust2. - RCON: Use remote console to manage the server: connect, then type
rcon_password secure_rcon_passwordfollowed byrcon status. - Player limits: CS2 supports up to 128 players. Adjust with
sv_maxplayers 32in server.cfg. - Updates: Periodically re-run the SteamCMD download command to stay current:
./steamcmd.sh +login anonymous +app_update 730 validate +quit. - Performance: Monitor CPU and memory usage. A typical 32-player server uses 1–2 GB RAM and significant CPU; larger servers or more players may need a more powerful instance.