Setting Up a Counter-Strike 2 Dedicated Server
Deploy a CS2 server using SteamCMD on your dedicated server.
Step 1 — Install SteamCMD
add-apt-repository multiverse -y
dpkg --add-architecture i386
apt update
apt install steamcmd -y
Step 2 — Create a Steam User
adduser steam
su - steam
Step 3 — Download CS2 Server Files
steamcmd +force_install_dir ~/cs2server +login anonymous +app_update 730 validate +quit
This may take 15–30 minutes depending on your connection speed.
Step 4 — Create a Startup Script
cat > ~/start-cs2.sh << 'EOF'
#!/bin/bash
cd ~/cs2server
./game/bin/linuxsteamrt64/cs2 -dedicated +map de_dust2 +maxplayers 20 -port 27015
EOF
chmod +x ~/start-cs2.sh
Step 5 — Open Firewall Ports
ufw allow 27015/tcp
ufw allow 27015/udp
ufw allow 27020/udp
Step 6 — Start the Server
screen -S cs2 ./start-cs2.sh
Players connect by searching for your server IP in the CS2 server browser.