...

Set Up a Counter-Strike 2 Dedicated Server on Ubuntu

CS2 Ubuntu Server Setup Guide banner

To set up a CS2 dedicated server on Ubuntu, install SteamCMD, download Steam app 730, create a Game Server Login Token, and start the game with -dedicated. Allow the game port through your firewall, then join from a separate network to check that players can reach it.

A server of your own gives you control over maps, passwords, match settings, and restart times. It can host private practice sessions, scrims, or a community server without depending on a player’s computer to stay online.

In this guide, we use Ubuntu 24.04 LTS and a plain SteamCMD installation. We explain each stage, show what to check, and include a systemd service, update procedure, and recovery steps. The commands assume one CS2 server instance on a fresh machine.

CS2 dedicated server setup at a glance

The main steps are:

  1. Prepare Ubuntu and create a separate server account.
  2. Install SteamCMD and download CS2 app 730.
  3. Create and store a Game Server Login Token.
  4. Configure the server name, password, map, and game mode.
  5. Start CS2 and allow the required game traffic.
  6. Connect from another network and check the result.
  7. Add automatic startup, backups, and a controlled update routine.

一台 专用游戏服务器 is a process that runs the match without rendering a player’s game view. That process can run on a VPS or a physical dedicated server. These are different meanings of “dedicated”: the application does not require exclusive physical hardware simply because it is called a dedicated server.

What do you need to host a CS2 server?

You need a suitable Linux machine, administrative access, enough free storage, and a reachable network address. You also need a Steam account that can create a Game Server Login Token for an internet server.

零件 Starting point for this guide 检查什么
操作系统 Ubuntu 24.04 LTS, x86_64 These commands target Ubuntu’s package layout
CPU Modern CPU with adequate available processing time Busy shared vCPUs can cause uneven server performance
RAM Start planning around 8 GB for a small trial deployment Measure real use with your maps, players, bots, and plugins
存储 Plan around 100 GB of available SSD capacity initially Leave room for the changing game download, updates, logs, and backups
网络 Reachable public IPv4 address Check upstream filtering and host firewall rules
访问 SSH account with sudo Keep a recovery console available while changing firewall rules
Steam account Account eligible to create a GSLT Review Valve’s current account requirements

The RAM and storage figures above are planning allowances, not measured player limits or official minimums. Check disk use after installation and test the actual workload before choosing a long-term plan.

Choose the region based on where your players connect from. Route quality, distance, packet loss, and CPU availability all affect the result. A larger network port does not by itself give every player lower ping. Our guide to choosing the best game server location explains that decision.

Can you host CS2 on a VPS?

Yes. A VPS can run the CS2 dedicated server if its architecture, memory, storage, and available CPU time meet the workload. Check the provider’s game hosting policy, public IP access, and UDP filtering before ordering.

Physical dedicated hardware becomes useful when you need more control over CPU resources or want to run several busy instances. For a small private group, start with a measured workload rather than choosing by advertised slot counts alone.

Step 1: Prepare Ubuntu and create a server account

Run the commands in this section from your normal sudo administrator account. The game itself will run as a separate user called steam.

First, inspect the machine:

猫 /etc/os-release

uname -m

df -h /home

 

Confirm that the operating system matches the guide and that the architecture is x86_64. An ARM VPS is not a drop-in replacement for this installation.

Update the package list and install the tools used below:

 

sudo apt 更新

sudo apt install software-properties-common ca-certificates nano ufw

sudo add-apt-repository multiverse

sudo dpkg –add-architecture i386

sudo apt 更新

sudo apt install steamcmd lib32gcc-s1 lib32stdc++6

 

Follow the package prompts, including the Steam license prompt if it appears. SteamCMD can need 32-bit support even though the CS2 game server uses a 64-bit executable.

Create the game account on a fresh host:

 

sudo adduser –disabled-password –gecos “” steam

sudo chmod 750 /home/steam

sudo -iu steam

 

The last command switches to the steam account. It does not give that account sudo rights. Install OS packages as the administrator and run game files as steam.

 

Check SteamCMD:

 

/usr/games/steamcmd +quit

It may update itself on first use. If the executable is missing, return to the administrator shell and inspect the package installation before continuing.

Step 2: Install the Counter-Strike 2 dedicated server

CS2 uses Steam app ID 730 for the server files. App ID 740 belongs to the older CS:GO dedicated server and should not be used for this procedure.

While signed in as steam, create the installation directory and download the game:

mkdir -p /home/steam/cs2

/usr/games/steamcmd \

  +force_install_dir /home/steam/cs2 \

  +login anonymous \

  +app_update 730 validate \

  +quit

Keep force_install_dir 前 login. The anonymous login downloads the files without putting a personal Steam password into a script. Creating a server login token is a separate step.

那个 validate argument asks SteamCMD to check installed game files. It can replace modified files that belong to the game package, so keep custom configuration backups before using it on an existing server.

Look for SteamCMD’s successful installation message, then check the files:

ls -l /home/steam/cs2/game/cs2.sh

ls -l /home/steam/cs2/game/bin/linuxsteamrt64/cs2

du -sh /home/steam/cs2

df -h /home/steam/cs2

A completed download proves that the files are present. It does not prove that a player can connect.

Check the Steam client library if startup fails

A missing steamclient.so error usually points to a library path or user-account problem. First locate the 64-bit library installed with SteamCMD:

find /home/steam/.本地 /home/steam/.steam \

  -path ‘*/linux64/steamclient.so’ -type f 2>/dev/null

 

On a common Ubuntu package layout, it may be here:

/home/steam/.local/share/Steam/steamcmd/linux64/steamclient.so

 

Use the path that actually exists. If that example path is present and the SDK link does not already exist, create the link as steam:

mkdir -p /home/steam/.steam/sdk64

ln -s /home/steam/.本地/share/Steam/steamcmd/linux64/steamclient.so \

  /home/steam/.steam/sdk64/steamclient.so

readlink -f /home/steam/.steam/sdk64/steamclient.so

Do not replace an existing file blindly. Inspect it first. The source path must match your SteamCMD installation, and the destination must belong to the account running CS2.

Step 3: Create a CS2 Game Server Login Token

一台 Game Server Login Token, or GSLT, gives your game server a Steam identity. Create one for an internet server through Steam Game Server Account Management.

Sign in through your browser, use app ID 730, enter a short memo, and create the token. Use a separate token for each server instance

Valve lists account conditions on that page, including an unrestricted account, a qualifying registered phone, and ownership of the relevant game. Review the live requirements if the form refuses your request.

Keep the token private. If you publish it by mistake, delete it in Steam and replace it. Valve also notes that unused tokens can expire and that certain password resets regenerate tokens.

Store the token in a private configuration file

As steam, create the file before editing it so it starts with restricted permissions:

install -m 600 /dev/null /home/steam/cs2/game/csgo/cfg/steam-auth.cfg

nano /home/steam/cs2/game/csgo/cfg/steam-auth.cfg

Add this line and replace the placeholder inside the editor:

sv_setsteamaccount “YOUR_GSLT”

The launch command below executes this file before loading the map. This keeps the literal token out of the command line and shell history. Keep backups of this file private too. Administrators and the game process can still read it, and logs may contain account details, so review logs before sharing them.

Step 4: Configure the server name, password, and game mode

CS2 still uses a directory named csgo for several game files. For this installation, the main custom configuration is:

/home/steam/cs2/game/csgo/cfg/server.cfg

 

On the fresh installation, create and edit it as steam:

 

install -m 600 /dev/null /home/steam/cs2/game/csgo/cfg/server.cfg

nano /home/steam/cs2/game/csgo/cfg/server.cfg

 

Use a small starting configuration:

 

hostname “Our CS2 Practice Server”

sv_lan 0

sv_password “CHANGE_TO_A_PRIVATE_MATCH_PASSWORD”

 

组 sv_password “” if you want to allow players without a match password. Keep a password in place during setup so unexpected players do not join your checks.

环境 目的
hostname Name displayed for your server
sv_lan 0 Internet server mode
sv_password Password required to join the match
sv_setsteamaccount Steam server identity, stored in the separate private file

A private match password is different from a GSLT. The password controls player entry; the token identifies the server to Steam. A password-protected internet server is also different from a LAN-only server.

We select competitive mode and de_dust2 in the launch command. Start with a standard map and no plugins. Add custom content after the basic server works so you can identify which change causes a problem.

Step 5: Start CS2 and configure the firewall

Start the server in the foreground as steam:

 

光盘 /home/steam/cs2/game

./cs2.sh -dedicated -port 27015 \

  +exec steam-auth.cfg \

  +game_type 0 +game_mode 1 \

  +exec server.cfg \

  +map de_dust2

 

使用 cs2.sh, which prepares the Linux runtime environment. Launching the executable directly can skip library setup required by the game.

Watch the console for map loading, Steam connection status, and fatal errors. Message wording can change between builds. Do not treat every warning as a failed start, and do not assume that a loaded map proves public access.

Keep that terminal open. In a second administrator SSH session, check the UDP listener:

 

sudo ss -lunp ‘sport = :27015’

 

Confirm the process listens on an address that can receive external traffic. A listener restricted to 127.0.0.1 cannot accept public connections.

Which ports should you open?

For this example, allow inbound UDP 27015 for gameplay. Valve’s general Steam port reference lists TCP 27015 for Source RCON. Only expose remote administration when you need it, and restrict it to trusted administrator addresses.

交通 Example port Access scope
CS2 gameplay UDP 27015 Players’ source addresses, or public access for an open server
SSH Your configured SSH TCP port Trusted administrator address where practical
RCON, if used TCP 27015 by default Trusted administrator address only
Downloads and Steam services Outbound connections Follow current Steam requirements if outbound traffic is restricted

The procedure does not require opening every Steam client or Remote Play port to inbound internet traffic.

Before enabling UFW, preserve your actual SSH port. On a new host using the default OpenSSH profile:

 

sudo ufw allow OpenSSH

sudo ufw allow 27015/udp

sudo ufw状态详细

sudo ufw enable

 

If SSH uses a custom port, allow that port first instead of relying on the profile. Keep your current session and provider console available, and test a second SSH connection after enabling the firewall. On a host with existing services, inspect its current rules before changing them.

Apply a matching UDP rule to any provider firewall or security group. Host rules cannot override an upstream block.

For hosting at home, forward UDP 27015 to the server’s LAN address. Carrier-grade NAT may prevent inbound access even when your router settings are correct. A public IP or another supported connectivity arrangement is needed in that case.

Step 6: Connect to your CS2 server from another network

The best reachability check is a real CS2 client joining from outside the server’s network. Use your gaming computer or ask a trusted player to connect.

In CS2, enable the developer console under the game settings. Open the console and enter the password, then the server address:

 

password “YOUR_PRIVATE_MATCH_PASSWORD”

connect YOUR_PUBLIC_IPV4:27015

 

Replace both placeholders. If you removed the server password, omit the first command.

Check that the correct map loads and the server uses your intended settings. Play briefly, reconnect, and confirm that the connection stays usable.

What does each setup check prove?

查 What it proves 它没有证明什么
SteamCMD reports success and files exist Installation completed Server can start
CS2 loads a map and binds UDP 27015 Local process is running Upstream firewall allows players
A client joins from another network External gameplay connection works All regions have acceptable latency
Server appears in the community browser Listing is visible to that search Every player will see the same result immediately

A TCP-only online port checker cannot prove that UDP gameplay works. A public browser listing is also a separate result from a successful direct connection.

If direct connection works but the browser listing does not, check the token, Steam connection status, browser filters, and listing delay before changing working firewall rules.

Step 7: Keep the server running with systemd

A systemd service starts CS2 at boot and gives you consistent stop, restart, and log commands.

First stop the foreground server with CTRL+C. Confirm that its UDP listener has closed before starting a second copy on the same port.

From the administrator account, create the service:

 

sudo nano /etc/systemd/system/cs2.service

 

添加:

 

[Unit]

Description=Counter-Strike 2 Dedicated Server

Wants=network-online.target

After=network-online.target

StartLimitIntervalSec=300

StartLimitBurst=5

 

[Service]

Type=simple

User=steam

Group=steam

WorkingDirectory=/home/steam/cs2/game

Environment=HOME=/home/steam

ExecStart=/home/steam/cs2/game/cs2.sh -dedicated -port 27015 +exec steam-auth.cfg +game_type 0 +game_mode 1 +exec server.cfg +map de_dust2

Restart=on-failure

RestartSec=10

KillSignal=SIGINT

TimeoutStopSec=60

UMask=0077

 

[Install]

WantedBy=multi-user.target

 

The unit contains the private configuration filename rather than the token itself. It also limits repeated starts if the server keeps failing.

 

Check the unit syntax and start it:

 

sudo systemd-analyze verify /etc/systemd/system/cs2.service

sudo systemctl daemon-reload

sudo systemctl enable –now cs2

sudo systemctl status cs2 –no-pager

 

Inspect recent logs:

 

sudo journalctl -u cs2 -n 100 –no-pager

 

Repeat the external connection test. At a planned downtime window, reboot the host and confirm that the service starts and players can rejoin. A service that works before reboot has not yet proved boot persistence.

 

Useful administration commands are:

 

sudo systemctl stop cs2

sudo systemctl start cs2

sudo systemctl restart cs2

A systemd restart policy handles process failures. It does not prove match health or fix a blocked network path.

How to update your CS2 dedicated server safely

Update during a maintenance window. A game update can change files, interrupt a match, or affect plugins.

Tell players when the server will stop. Then stop it from the administrator account:

 

sudo systemctl stop cs2

sudo install -d -m 700 /var/backups/cs2

 

Create a dated configuration backup:

 

backup_stamp=$(date -u +%Y%m%dT%H%M%SZ)

sudo tar -czf “/var/backups/cs2/config-${backup_stamp}.tgz” \

  -C /home/steam/cs2 game/csgo/cfg

sudo chmod 600 “/var/backups/cs2/config-${backup_stamp}.tgz”

sudo cp /etc/systemd/system/cs2.service \

  “/var/backups/cs2/cs2-${backup_stamp}.service”

 

This archive includes the private token file. Protect it, and keep an encrypted copy outside the host if you need recovery after disk failure. It is a configuration backup, not a complete game or plugin backup. Include custom maps, plugin data, and external databases separately if you add them.

Download the current game files:

 

sudo -iu steam /usr/games/steamcmd \

  +force_install_dir /home/steam/cs2 \

  +login anonymous \

  +app_update 730 \

  +quit

 

Use the extra validate argument when checking suspected damaged game files. Back up custom changes first because package verification can replace modified shipped files.

Start the service and inspect the result:

 

sudo systemctl start cs2

sudo systemctl status cs2 –no-pager

sudo journalctl -u cs2 -n 100 –no-pager

 

Finish by joining from an external client. Keep automatic game updates separate from automatic crash restarts so an unexpected crash does not also trigger an unplanned software change.

Restore a broken configuration

If a setting change prevents startup, restore the last working configuration. Stop the service and inspect the archive before extracting it:

 

sudo systemctl stop cs2

sudo tar -tzf /var/backups/cs2/config-TIMESTAMP.tgz

 

更换 TIMESTAMP with the actual backup name. Preserve the failed configuration for diagnosis if needed, then restore:

 

sudo tar -xzf /var/backups/cs2/config-TIMESTAMP.tgz \

  -C /home/steam/cs2

sudo chown -R steam:steam /home/steam/cs2/game/csgo/cfg

sudo systemctl start cs2

 

Restore the saved unit and run systemctl daemon-reload too if you changed the service file. Check for newly added configuration files that the archive will not remove.

A configuration rollback does not roll back the game build. Restoring an old CS2 binary may leave it incompatible with current clients. After an update-related failure, also check current game and plugin compatibility.

Troubleshoot common CS2 dedicated server problems

Work from the first failed checkpoint. Changing several settings at once makes the cause harder to identify.

问题 第一次检查 Corrective action
SteamCMD cannot finish the install Free disk and directory ownership Free space, correct the install path, and retry as steam
cs2.sh is missing App ID and install directory Confirm app 730 and inspect the SteamCMD result
steamclient.so cannot load Actual SteamCMD library path and game user Repair the per-user link only after locating the existing library
Game client starts instead of a server Launch flags Include -dedicated
Server reports address already in use UDP listener and another running copy Stop the old copy or assign a separate port
Players time out UDP listener, host firewall, provider firewall Check each network layer and test from outside
Home players can join but internet players cannot Router forwarding and public address Correct the forward and check for CGNAT
Direct connection works but listing is absent Steam registration, token, filters Inspect registration logs before opening more ports
Token is rejected Token status and account conditions Replace or regenerate it in Steam and restart
Name or password changes do not apply File path, executed config, later overrides Confirm +exec server.cfg and inspect console messages
Client and server versions differ Latest update result Stop, update, restart, and reconnect
systemd repeatedly restarts CS2 First fatal error in the journal Fix the cause; after a start limit, use systemctl reset-failed cs2
Server runs until memory pressure increases Memory use, kernel OOM messages, other services Reduce load or add capacity after measurement

For a failed service, start with:

 

sudo journalctl -u cs2 -b -n 150 –no-pager

sudo ss -lunp ‘sport = :27015’

自由-H

df -h /home/steam/cs2

Read the first relevant error rather than only the final shutdown message. Remove tokens, passwords, and personal details before sending logs to support.

Improve CS2 server performance after it works

Measure performance during the player load you expect. A quiet server with an empty map does not show how it will behave during a busy match.

Check available CPU time, per-core load, memory use, disk activity during map changes, and packet loss from player locations. On a VPS, sustained CPU steal time can point to contention with other workloads on the host, although one metric alone does not establish the cause of lag.

Keep a simple record of the map, mode, player count, bots, plugins, and observed symptoms. Change one variable and repeat the same session before deciding whether hardware is the cause.

Do not copy old CS:GO tuning commands without checking whether CS2 still supports them. In particular, do not promise a 128-tick server just because a guide adds -tickrate 128. Source 2 behavior and available commands require current game-specific checks.

Add maps and plugins in stages

Start with the default server. Add one workshop map or plugin at a time, document its version, and repeat the connection and restart checks.

Tools such as Metamod:Source and CounterStrikeSharp have their own compatibility requirements. Game updates may break extensions even when the base server still starts. Keep a clean baseline you can return to.

Review Valve’s community-server rules before installing features that change inventories or player profiles. A plugin being available does not establish that its behavior is permitted.

When should you buy CS2 server hosting?

Buy CS2 server hosting when you need an always-on machine, a reachable public address, and a location suited to your players. The choice between managed game hosting, a VPS, and bare metal depends on how much administration you want to handle.

 

托管选项 适合使用 Your main responsibility
托管游戏托管 Teams that want panel-based game control Check the provider’s actual update, backup, and plugin support
Self-managed VPS Private groups and workloads that fit available resources OS security, installation, game updates, and monitoring
Self-managed dedicated server Several instances or workloads needing exclusive hardware OS and game operations, plus capacity planning

在 Atal Networks,我们的 专用游戏服务器 provide a hardware route for teams that need exclusive server resources and administrative control. Check the current CPU, storage, region, and network options against your workload before choosing a plan.

我们的 VPS hosting guide for game servers can help if you are starting with a smaller deployment. Confirm the scope of management and application support before purchase. Root access gives you control, but it also leaves operating-system and game administration with you on a self-managed plan.

经常问的问题

Is a CS2 dedicated server free?

The server software can be downloaded through SteamCMD without buying a separate server license. You still pay for the machine, storage, network access, and any management service. A free software download does not make hosting free.

What is the SteamCMD app ID for CS2?

Use app ID 730. CS2’s server files use the same application ID as the game. The older CS:GO dedicated-server app ID 740 is not the installation target for this guide.

Can I install a CS2 dedicated server on Ubuntu?

Yes. This procedure targets Ubuntu 24.04 LTS on x86_64 hardware. Other Linux releases can have different package names, library requirements, and SteamCMD paths. Check those differences before reusing the commands.

How much RAM does a CS2 server need?

It depends on the map, players, bots, plugins, and other processes. An 8 GB allocation is a planning starting point for a small trial here, not a tested slot guarantee. Measure memory during real play and keep room for the operating system and updates.

Do I need a GPU for a CS2 dedicated server?

The dedicated server runs game logic without rendering a player’s screen, so a gaming GPU is not part of this setup. Focus first on CPU availability, RAM, storage, and the network path.

Do I need a token for a private server?

For a password-protected server reached over the internet, use a GSLT in this setup. “Private” describes who can join, while LAN mode describes the network scope. A match password does not replace a Steam server token.

Which port does a CS2 server use?

This guide uses UDP 27015 for gameplay. If you select a different port with -port, update the firewall and player connection command. Optional administration or spectator features can have separate requirements.

Why is my CS2 server not showing in the browser?

Check Steam registration, the GSLT, browser filters, and server settings. Try direct connection from another network first. If direct join works, treat listing visibility as a separate problem instead of assuming that the whole server is unreachable.

Can I run multiple CS2 servers on one machine?

Yes, if the machine has enough capacity. Give each instance its own port, token, configuration, service definition, and writable data paths. Account for any extra ports used by optional features, then test the combined workload.

Can I use LinuxGSM or Docker instead of these commands?

Yes. LinuxGSM provides a CS2 management workflow, and container-based setups can package dependencies and instance settings. Their paths and service commands differ from this plain SteamCMD procedure. Follow one installation method consistently.

滚动至顶部
Seraphinite AcceleratorBannerText_Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.