LochStudios  /  Help Centre  /  Game Servers  /  Set up a Counter-Strike 2 dedicated server with SteamCMD

Set up a Counter-Strike 2 dedicated server with SteamCMD

Download Counter-Strike 2 with SteamCMD, set a Game Server Login Token, and open port 27015 on your LochStudios KVM VPS.

Updated

Counter-Strike 2 is Valve's competitive shooter. A dedicated server on a LochStudios KVM VPS stays online so friends (or the public) can join your maps and rules, without one player hosting from their PC.

This is not a cPanel or shared-hosting job. You need a Linux VPS (Ubuntu 22.04 or 24.04 LTS is the usual pick) and SSH. Need a machine first? Browse VPS. Unsure which size? Open a support ticket and tell us how many people will play. On a dedicated server we will size the box with you the same way.

Credentials, the IPv4, and an out-of-band console sit on that server in the portal. Sign in at the portal, open the VPS, and copy the login from there. Do not guess a hostname.

Before you start

  1. Sign in at the portal, open the VPS service, and keep that page open.
  2. Connect with a sudo user, or root on a fresh box.

- Connect to your VPS via SSH from macOS or Linux
- Connect to your VPS via SSH from Windows

  1. Patch the box and use a daily sudo user: First steps on a new VPS.
  2. Install SteamCMD under a dedicated steam user: Install SteamCMD on Linux.
  3. Leave at least 80 GB free. Valve lists about 65 GB for the dedicated server files. Logs, workshop maps, and the OS need the rest.
  4. Plan on UDP 27015 for gameplay (and TCP 27015 if you will use RCON). The Steam browser can also use 27015-27030.

If SSH from your computer will not connect, open the console on the same VPS service. That session does not need port 22 from your network.

CS2's Linux binary is 64-bit x86. That is what our KVM VPS images use. It is not an ARM workload.

RAM

Leave memory for the operating system. Valve's published minimum is 2 GB; that is too tight once the OS is running.

VPS RAMWhat it is for
4 GBA few friends, one map, no extras
8 GBComfortable 10 to 32 players
16 GBLarger slots, workshop maps, or other services on the same VPS

Pick a size on VPS, or open a support ticket and tell us how many people will play.

Step 1: Download the CS2 server

Log in as the steam user and pull Steam app 730. Valve publishes the CS2 client and dedicated server under that same app. You do not type a Steam password on the VPS for this download. Every player who joins still needs to own the game.

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

Wait until SteamCMD prints Success! and App '730' fully installed. The download is tens of gigabytes. Give it time.

Do not use app 740. That is the old CS:GO dedicated server and will not install CS2.

Step 2: Check the files

ls -la ~/cs2/game/cs2.sh
ls -la ~/cs2/game/bin/linuxsteamrt64/cs2

You should see the cs2.sh wrapper and the cs2 binary under linuxsteamrt64. Always start the server with cs2.sh. Do not call the binary in linuxsteamrt64 directly; the script sets library paths the process needs.

If SteamCMD finished instantly and those files are missing, run the same app_update command again. Still empty? Open a support ticket and include the SteamCMD output. Do not paste Steam passwords.

Point the Steam client library where CS2 looks for it:

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

If ~/steamcmd/linux64/steamclient.so is not there yet, run ./steamcmd.sh +quit once from ~/steamcmd and check again.

Step 3: Create a Game Server Login Token

Friends on the internet need a Game Server Login Token (GSLT). Without one, the process may start, but players off the VPS will not get a usable public session.

  1. In a browser, sign in to Steam (use an account you control).
  2. Open Steam Game Server Account Management.
  3. Create a token with App ID 730.
  4. Copy the token and keep it off the public internet.

Each public server needs its own token. Do not put the token in a support ticket.

Step 4: Create server.cfg

Still as steam:

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

Paste a small starting config, then change the name and passwords:

hostname "My CS2 Server"
sv_password "change-me-now"
rcon_password "change-this-rcon"
sv_lan 0
sv_cheats 0
mp_maxrounds 24

Leave sv_password empty (sv_password "") if anyone may join. Keep a password for a private group.

Save the file (Ctrl+X, then Y, then Enter).

Do not put sv_maxplayers in this file. CS2 takes the slot cap from the -maxplayers launch flag (maximum 64). Competitive match slots stay at 10 even when the cap is higher.

Step 5: Create a startup script

Steam overwrites files inside ~/cs2 on every update. Keep your launch flags in a script outside that folder.

nano ~/cs2_start.sh

Paste this, then put your GSLT in place of YOUR_GSLT_TOKEN:

#!/bin/bash
cd ~/cs2/game
./cs2.sh -dedicated -usercon -port 27015 -maxplayers 10 \
  +sv_setsteamaccount "YOUR_GSLT_TOKEN" \
  +map de_dust2 \
  +game_alias competitive \
  +exec server.cfg

Save the file and make it executable:

chmod +x ~/cs2_start.sh

Game mode aliases:

ModeLaunch flag
Competitive+game_alias competitive
Wingman+game_alias wingman
Casual+game_alias casual
Deathmatch+game_alias deathmatch

Change +map de_dust2 to another official map (de_mirage, de_inferno, and so on) when you want a different start map.

Step 6: Open the ports

Two filters can block players. Open both.

Portal Firewall tab (the filter in front of the VPS):

  1. Sign in at the portal and open the VPS.
  2. Open the Firewall tab.
  3. If no rules are listed, we are not filtering at that layer. Skip to UFW.
  4. If you already added Drop rules, add an Accept for UDP 27015 (and TCP 27015 if you use RCON) and keep an Accept for SSH (22, TCP) ahead of any Drop. If the community browser cannot see the server, Accept 27015-27030 UDP and TCP as well.

Full walkthrough: Open the Right Firewall Ports for Your Game Server.

UFW on Ubuntu or Debian (from your sudo account, not steam):

sudo ufw allow 27015/udp
sudo ufw allow 27015/tcp
sudo ufw reload
sudo ufw status

If the server browser still cannot see you:

sudo ufw allow 27015:27030/udp
sudo ufw allow 27015:27030/tcp
sudo ufw reload

Allow SSH (22/tcp) before you ever run sudo ufw enable. See Set up a UFW firewall on Ubuntu.

If a rule locks you out of SSH, use the console on the VPS, or open a support ticket.

Step 7: Start the server

As steam:

su - steam
~/cs2_start.sh

Wait until the log shows the map loading and a line that the server is accepting players.

Leave that terminal open while you test. Ctrl+C is the clean stop. Do not kill the window another way or the process can keep running in the background.

Step 8: Join from the game

On your PC:

  1. Copy the VPS IPv4 from the portal.
  2. Launch CS2.
  3. Turn on the developer console (Settings, Game, Enable Developer Console).
  4. Press ~ and type:
connect YOUR-VPS-IPV4:27015

If you set sv_password:

connect YOUR-VPS-IPV4:27015; password change-me-now

Friends use the same IPv4 and port. With a valid GSLT and sv_lan 0, the name from hostname can also appear in the community server browser.

Do not use Play → Practice (offline with bots) to reach this VPS. That only starts a local listen server on your PC.

If nobody can connect, re-check the Firewall tab, sudo ufw status, and that the process is still running (sudo ss -tulnp | grep 27015). Still stuck? Open a support ticket and include the VPS service, the IPv4, and the port. Do not put the GSLT, sv_password, or RCON password in the ticket.

Keep it running after you disconnect

For a first test, run it in screen or tmux so SSH can close without stopping the process. See Run a game server persistently with screen or tmux.

su - steam
screen -S cs2
~/cs2_start.sh

Detach with Ctrl+A, then D. Reattach with screen -r cs2.

For something that comes back after a reboot or a crash, use a systemd unit: Keep a Game Server Running and Auto-Restarting with systemd. Point ExecStart at /home/steam/cs2_start.sh and run the service as steam.

Update the server

Stop the process first (Ctrl+C in the screen session, or stop the systemd unit). Then, as steam:

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

Start the script again. ~/cs2_start.sh sits outside the install folder, so Steam will not overwrite the launch flags or token. Keep a copy of server.cfg in ~ if you edit it often, in case an update replaces files under ~/cs2/game/csgo/cfg.

Notes

  • RCON: -usercon lets you type commands in the server console. From the CS2 client, set rcon_password to the value in server.cfg, then rcon status. Change that password after the first test.
  • Player cap: -maxplayers accepts up to 64. Competitive still plays 5v5. Start at 10 and raise it only if you need more slots.
  • Workshop or insecure plugins: custom maps and third-party server plugins are their own topic. Start vanilla. If you add them later and VAC must stay off, that is a private, trusted group only.
  • CPU and RAM: watch usage with Monitor Server Resources. If the VPS is tight, resize from the portal or open a support ticket.

Need a hand with the VPS, the firewall, or a server that will not list? Open a support ticket.


Was this article helpful?

← Back to Game Servers