Hosting a game server on a VPS: a CS2 example, resource needs and security
The general steps to set up a game server with SteamCMD: a user, installation, firewall ports, a systemd service and monitoring.
Tutorials · 3 min read
Your own game server lets you set the rules, plugins and player list. This guide explains the general installation logic for Steam-based dedicated servers (using CS2 as the example); similar steps apply to many other games.
Resource needs
- CPU: game servers are usually sensitive to single-core performance. High clock speed and dedicated cores reduce latency; plans with dedicated cores in the Max Performance (VDS) family suit this (see VDS vs VPS CPU comparison).
- Memory: 4–8 GB is a start for most setups; it grows with plugins and player count.
- Disk: game files can run to tens of GB. Check the install size on the game’s Steam page and leave a margin.
- Network: connection quality and latency define the player experience; choose a location close to your players (see Our data centres).
1. Preparation
On Ubuntu 24.04, enable 32-bit library support and install SteamCMD:
sudo apt update && sudo apt install -y software-properties-common
sudo add-apt-repository -y multiverse
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y steamcmd lib32gcc-s1
If it asks about the Steam licence agreement during installation, accept it.
2. A separate user for the server
sudo adduser --disabled-password --gecos "" gameserver
sudo -iu gameserver
Never run a game server as root; if it is compromised the damage stays limited to the user.
3. Install the game
/usr/games/steamcmd +force_install_dir /home/gameserver/cs2 +login anonymous +app_update 730 validate +quit
730 is the Steam app ID of the CS2 dedicated server. To update, simply run the command again.
4. Run it
cd /home/gameserver/cs2
./game/bin/linuxsteamrt64/cs2 -dedicated +map de_dust2 +sv_setsteamaccount SERVER_TOKEN
For servers listed on the internet, create the game server login token (GSLT) the game requires from your Steam account and pass it with +sv_setsteamaccount. Don’t share the token with anyone.
5. Firewall
Open the game port (the CS2 default is 27015, UDP and TCP):
sudo ufw allow 27015/udp
sudo ufw allow 27015/tcp
Keep the RCON (remote administration) password strong and, where possible, open the RCON port only to your own IP address:
sudo ufw allow from 203.0.113.50 to any port 27015 proto tcp
6. Keep it running: systemd
To start the server automatically after reboots, create /etc/systemd/system/cs2.service:
[Unit]
Description=CS2 Dedicated Server
After=network.target
[Service]
User=gameserver
WorkingDirectory=/home/gameserver/cs2
ExecStart=/home/gameserver/cs2/game/bin/linuxsteamrt64/cs2 -dedicated +map de_dust2
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now cs2
sudo journalctl -u cs2 -f
Monitoring and maintenance
- Updates: when the game updates the server reports a version mismatch; stop the service and run the
app_updatecommand again. - Resources: watch CPU and memory with
htop; if latency rises as players join, upgrade your plan. - Backups: back up configuration and plugin files; take a snapshot before big changes.
- Attacks: game servers are frequent targets; apply the firewall and the security checklist.
When you run a game server, comply with the game’s terms of service and licence rules.
Start with Melinhost
Our cloud servers with dedicated cores and, when needed, our dedicated servers provide a good foundation for game servers.