TürkiyeVPS

How to Set Up a CS2 Server: Counter-Strike 2 Dedicated Server on Linux with SteamCMD

Set up a Counter-Strike 2 server for your friends or community on Ubuntu 24.04: SteamCMD, server files, Game Server Login Token, server.cfg, game modes, firewall, a systemd service and automatic updates.

7 min read

With your own Counter-Strike 2 server, you decide the match settings, the map rotation and who gets to join. Whether it's for private matches with friends, team practice or a community server, the most reliable approach is to run it on a Linux server that stays online around the clock. In this guide we'll set up a CS2 dedicated server on Ubuntu 24.04 using Valve's official tools.

Quick summary: you download the CS2 server files (App ID 730) anonymously with SteamCMD, get a Game Server Login Token from Steam, and start the cs2 server binary with the right game mode parameters. The server files are large; set aside at least 60 GB of free disk space.

How many resources do you need?

  • Disk: The CS2 server files take up tens of gigabytes (over 35 GB at the time of writing) and grow with every update. Updates also need temporary space. Allocate at least 60 GB, preferably 80 GB or more. An NVMe disk speeds up map loading.
  • RAM: For a 10-12 player competitive or deathmatch server, 4 GB is a comfortable starting point. If you use plugins, you may need more.
  • CPU: A CS2 server relies on single-core performance for tick calculations and is very sensitive to latency. On a server with shared CPU you may see stutters at peak hours; choose a server with dedicated CPU.

1. Prepare the system

Connect to your server over SSH. SteamCMD needs 32-bit libraries, so we enable the i386 architecture and install the required packages:

sudo dpkg --add-architecture i386
sudo apt update && sudo apt upgrade -y
sudo apt install -y lib32gcc-s1 lib32stdc++6 curl tmux

Don't run the server as root. Create a separate user:

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

2. Install SteamCMD

SteamCMD is Valve's command-line tool for downloading and updating server files. Switch to the cs2 user and download the official package:

sudo -iu cs2
mkdir -p ~/steamcmd && cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

3. Download the CS2 server files

The CS2 server files use the same App ID as the game itself (730) and can be downloaded with an anonymous login:

~/steamcmd/steamcmd.sh +force_install_dir /home/cs2/cs2-ds +login anonymous +app_update 730 validate +quit

Depending on your connection speed, the download may take more than a few minutes. When it finishes, you should see the line Success! App '730' fully installed. If you get an error, simply running the command again is usually enough; SteamCMD resumes where it left off.

Link the library the server needs to connect to Steam into the location it expects. If you skip this step, the server may fail at startup with a steamclient.so error:

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

4. Get a Game Server Login Token (GSLT)

Your server needs a GSLT to be visible on the internet and for players to connect. In your browser, go to steamcommunity.com/dev/managegameservers with your Steam account, enter 730 as the App ID, add a memo and create the token. Steam checks a few conditions on your account for this page (e.g. it must not be a limited account and must have a phone number attached). Copy the long code that is generated; in the next steps you'll put it where it says TOKEN. Don't share the token with anyone.

5. Create the server.cfg file

Server settings live in the game/csgo/cfg/server.cfg file:

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

A basic configuration:

hostname "Benim CS2 Sunucum"
sv_password ""
rcon_password "GucluBirRconSifresi"
sv_lan 0
sv_cheats 0
mp_autoteambalance 1

If you set a password in sv_password, your server is open only to people who know it, which is handy for private matches. rcon_password lets you manage the server remotely from inside the game; be sure to choose a strong password.

6. Open the firewall

By default the CS2 server uses port 27015. Game traffic goes over UDP, while RCON uses TCP. Switch back to your own user (exit) and run:

sudo ufw allow OpenSSH
sudo ufw allow 27015/udp
sudo ufw allow 27015/tcp
sudo ufw enable

7. Start the server

Let's do the first test run in a tmux session:

sudo -iu cs2
tmux new -s cs2
~/cs2-ds/game/bin/linuxsteamrt64/cs2 -dedicated -usercon -port 27015 +game_type 0 +game_mode 1 +map de_dust2 +sv_setsteamaccount TOKEN +exec server.cfg

Replace TOKEN with the code you got in step 4. In the console you should see lines showing that the map has loaded and the server has connected to Steam. Press Ctrl+B, then D to detach from the session; the server keeps running.

To join, open the developer console in CS2 (enable it under Settings > Game) and type connect SUNUCU_IP:27015, using your server's IP address. If you set a password, enter password SIFRE first.

Game modes

The game mode is determined by the combination of the game_type and game_mode parameters:

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

For example, for a deathmatch server use +game_type 1 +game_mode 2 in the start command.

8. systemd service and automatic updates

When Valve updates CS2, players can no longer connect to servers running the old version. A practical solution is to update the server every time before it starts. First stop the server in tmux (tmux attach -t cs2, then type quit), then create the service file as your own user:

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

[Service]
User=cs2
WorkingDirectory=/home/cs2/cs2-ds
ExecStartPre=/home/cs2/steamcmd/steamcmd.sh +force_install_dir /home/cs2/cs2-ds +login anonymous +app_update 730 +quit
ExecStart=/home/cs2/cs2-ds/game/bin/linuxsteamrt64/cs2 -dedicated -usercon -port 27015 +game_type 0 +game_mode 1 +map de_dust2 +sv_setsteamaccount TOKEN +exec server.cfg
Restart=on-failure
RestartSec=15
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

TimeoutStartSec=0 prevents systemd from cancelling the start during long updates. Enable the service:

sudo systemctl daemon-reload
sudo systemctl enable --now cs2
sudo journalctl -u cs2 -f

When an update comes out, sudo systemctl restart cs2 first updates the server and then restarts it. If you like, you can run this command every night with cron at an hour when few players are online.

A quick note on plugins

For admin menus, statistics or custom modes, community-developed plugin frameworks such as Metamod:Source and CounterStrikeSharp are used. Since their installation changes frequently with game updates, follow their own official documentation, and after a major CS2 update wait for compatible plugin versions to be released.

TürkiyeVPS game servers for CS2

A CS2 server needs both disk space and single-core performance. Our game server plans come with dedicated vCPUs on an Intel Core i5-10400F, guaranteed RAM, a 60-100 GB disk, your own IPv4 address and root access; for CS2, the plan with 4 GB RAM and an 80 GB disk is a comfortable start. The servers are in Istanbul, so latency is low for players in Turkey. Because their disk space is small, our standard VPS plans are not suitable for CS2. For other games, check out our guides on setting up a FiveM server and setting up a Minecraft server.

Frequently Asked Questions

Is it free to set up a CS2 server?

The CS2 server software and the GSLT are free. You only pay for the machine the server runs on. You can also host a server on your own computer, but when the computer shuts down, so does the server.

How much disk space does a CS2 server need?

The server files take up tens of gigabytes and grow with updates. Leaving room for updates as well, allocate at least 60 GB, preferably 80 GB or more.

My server doesn't show up in the list or players can't connect. What should I do?

First check with sudo ufw status that UDP port 27015 is open. Then make sure you're using a valid GSLT in the start command and that sv_lan 0 is set. Finally, run the app_update 730 command again to confirm the server is up to date.

Can I set up a 128-tick server?

Instead of the old tick rate settings, CS2 uses a system called "sub-tick"; you don't need to choose a tick rate as you did in CS:GO. What really affects the gameplay experience is the stability of the server's CPU and the latency to players.