Gratisvps.net | Blog Daily Tech Info

Discover reliable VPS server solutions

How to Set up a CS2 Server

 Compatibility

Counter-Strike 2 will run on popular distros as long as the minimum requirements are met.

 Server

For consistant uptime it is recomended you host a server in a data center. If you dont already have a server, you can rent a dedicated or vitual server from one of our sponsored providers, OVHCloudLinodeVultr.

 Minimum Recommended Distros

 Other Distros

Although not tested, any distro with tmux => 1.6 and glibc => 2.31 should also be compatible with Counter-Strike 2 servers.

 SteamCMD

SteamCMD by Valve is used to install and update this game server.

 Dependencies

Before installing, you must ensure you have all the dependencies required to run cs2server.

These intructions also cover other RHEL derivatives such as AlmaLinux and Rocky Linux.

Ubuntu 20.04

Ubuntu Icon

sudo dpkg --add-architecture i386; sudo apt update; sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd

Ubuntu 22.04 and above

Ubuntu Icon

sudo dpkg --add-architecture i386; sudo apt update; sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc-s1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd

 Gamedig

GameDig is a recommended additional module that allows LinuxGSM to gather more info from the game server such as current map and connected players to be displayed in details and in logs. It also replaces the default LinuxGSM query module in monitor. To install GameDig follow the steps in the LinuxGSM documentation.

 Install Dependencies Using LinuxGSM

It is possible for LinuxGSM to install dependencies either by having the cs2server user account with sudo access or running the installer as root.

user with sudo access

During the installation if the game server user has sudo permissions LinuxGSM will attempt to install any missing dependencies itself.

root user

if cs2server is already installed run ./cs2server install as root and LinuxGSM will automatically install missing dependencies. SteamDB

Steam uses appid 730.
Update history is available from SteamDB.

 Install

From the command-line do the following. Ensuring you have also installed the required dependencies.

1. Create a user and login.

adduser cs2server

For security best practice, ensure you set a strong password. Random password: Dg1MTg3ODYyM

su - cs2server

2. Download linuxgsm.sh.

curl -Lo linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh cs2server

3. Add Steam login details.

You will need to enter a Steam username and password to download dedicated server.

It is recommended that you create a new Steam username just for the server.

nano lgsm/config-lgsm/cs2server/common.cfg
steamuser="username"
steampass='password'

4. Run the installer following the on-screen instructions.

./cs2server install

 Game Server Login Token (GSLT)

GSLT is required by this game server to show up on the  Steam master server list.

To register your server visit Steam Game Server Account Management.

For information about GSLT visit the docs.

 Basic Usage

All Commands

A complete list of commands can be found by typing.

./cs2server

Below are the most common commands available.

Running

start

./cs2server start

stop

./cs2server stop

restart

./cs2server restart

console

Console allows you to view the live console of a server as it is running and allow you to enter commands; if supported.

./cs2server console

To exit the console press CTRL+b d. Pressing CTRL+c will terminate the server.

Updating

update

Update checks for any server updates and applies them. The server will update and restart only if required.

./cs2server update

Bypass the check and go straight to SteamCMD update.

./cs2server force-update

validate

You can use the SteamCMD validate option when updating the server.

./cs2server validate

Debugging

Details

You can get all important and useful details about the server such as passwords, ports, config files etc.

./cs2server details

Debug

Use debug mode to help you if you are having issues with the server. Debug allows you to see the output of the server directly to your terminal allowing you to diagnose any problems the server might be having.

./cs2server debug

Logs

Server logs are available to monitor and diagnose your server. Script, console and game server (if available) logs are created for the server.

/home/cs2server/logs

Backup

Backup will allow you to create a complete tar bzip2 archive of the whole server.

./cs2server backup

Monitor

LinuxGSM can monitor the game server by checking that the proccess is running and querying it. Should the server go offline LinuxGSM can restart the server and send you an alert. You can use cronjobs to setup monitoring.

./cs2server monitor

Configure LinuxGSM

For details on how to alter LinuxGSM settings visit LinuxGSM Config Files page.

Documentation

For detailed documentation visit the LinuxGSM docs.

Cronjobs

To automate LinuxGSM you can set scheduled tasks using cronjobs, to run any command at any given time. You can edit the crontab using the following.

crontab -e

Below are the recommended cron tasks.

*/5 * * * * /home/cs2server/cs2server monitor > /dev/null 2>&1
*/30 * * * * /home/cs2server/cs2server update > /dev/null 2>&1
0 0 * * 0 /home/cs2server/cs2server update-lgsm > /dev/null 2>&1

Configure LinuxGSM

For details on how to alter LinuxGSM settings visit LinuxGSM Config Files page.

Documentation

For detailed documentation visit the LinuxGSM docs.