Deployment Overview of Counter-Strike 2 Server on Server¶
Prerequisites and Basic Requirements¶
To ensure the successful deployment and operation of the Counter-Strike 2 server, the following requirements must be met:
-
Operating System: Ubuntu (with multiverse repository enabled).
-
Architecture Support: i386 architecture must be added to the system.
-
Privileges: Root or sudo privileges are required for package installation and directory management.
-
Network Requirements: Access to Steam content delivery networks (CDNs) is necessary to download game files via
steamcmd.
FQDN of the final panel on the hostkey.in domain¶
The following table describes the domain template used for the server's access:
| Parameter | Value |
|---|---|
| Prefix | plane |
| Domain | hostkey.in |
| Full template | plane{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The application utilizes the following directory structure for installation, configuration, and runtime data:
-
/opt/cs2: Main installation directory for the Counter-Strike 2 server files. -
/opt/cs2/game/game/cfg/cs2server.cfg: Server configuration file. -
/root/.steam/sdk64/: Directory containing required Steam SDK libraries. -
/tmp/cs2server.pid: File used to track the active process ID of the server. -
/var/log/cs2server.log: Log file for the server application.
Application installation process¶
The Counter-Strike 2 server is installed using a combination of system package management and the Steam Command Line Interface (steamcmd). The installation follows these steps:
-
System Preparation: The
multiverserepository is enabled, i386 architecture is added, and all system packages are updated to their latest versions. -
Environment Setup: A dedicated directory
/opt/cs2is created for the game files. -
SteamCMD Installation:
-
The
steamcmdpackage is installed via the system package manager. -
The Steam installation binaries are extracted into
/opt/cs2. -
Game Download: An automated process executes
steamcmdto: -
Set the installation directory to
/opt/cs2/game. -
Log in anonymously.
-
Download and validate the Counter-Strike 2 application (App ID 730).
-
Library Configuration: The Steam client library (
steamclient.so) is copied from the game files to/root/.steam/sdk64/to ensure proper runtime execution. -
Configuration Deployment: A custom server configuration file
cs2server.cfgis placed in the game's configuration directory.
Access Rights and Security¶
-
File Permissions:
-
Installation directories are set with
0755permissions. -
The management script
/root/cs2server.shis configured with executable permissions (0755). -
Process Isolation: The server runs as a dedicated process, and its PID is tracked in
/tmpto prevent multiple instances from running simultaneously.
Custom Scripts and Additional Setup¶
A custom management script is provided to control the lifecycle of the application:
Server Management Script: /root/cs2server.sh This script allows for manual control over the server process with the following commands:
-
start: Launches the dedicated server in the background usingnohup, redirecting output to/var/log/cs2server.log. -
stop: Terminates the running server process using its stored PID. -
restart: Stops and then starts the server. -
status: Checks if the server is currently active by verifying the existence of the PID file and the associated system process.
Docker Containers and Their Deployment¶
The deployment includes a containerized Nginx service used for managing SSL certificates via Certbot:
| Service | Image | Ports | Volumes | Environment Variables | Restart Policy |
|---|---|---|---|---|---|
nginx | jonasal/nginx-certbot:latest | Host Network | - nginx_secrets:/etc/letsencrypt- /data/nginx/user_conf.d:/etc/nginx/user_conf.d | [email protected] | unless-stopped |
Application Update Instructions¶
To update the Counter-Strike 2 server, you must use the Steam Command Line Interface to validate and download the latest files:
-
Navigate to the installation directory containing
steamcmd. -
Execute a command to run
steamcmdwith the following parameters: -
force_install_dir /opt/cs2/game -
login anonymous -
app_update 730 validate
Location of configuration files and data¶
-
Server Config:
/opt/cs2/game/game/csgo/cfg/cs2server.cfg -
Application Logs:
/var/log/cs2server.log -
Steam SDKs:
/root/.steam/sdk64/
Available ports for connection¶
The application utilizes the standard Counter-Strike 2 networking ports (typically UDP 27015 and related game ports), which must be opened in your firewall to allow player connections.
Starting and Stopping the application¶
Use the management script located in the root directory:
To start the server:
To stop the server:
To check server status: