This guide provides instructions on how to install a Counter-Strike: Source (CS:S) or Counter-Strike: Global Offensive (CS:GO) server using steamcmd on Rocky Linux. It also covers how to install NGINX on Rocky Linux and set up a proxy for the UDP port used by the game server.
sudo privilegesUpdate Your System:
sudo dnf update -y
Install Dependencies:
sudo dnf install glibc.i686 libstdc++.i686 gcc wget curl -y
Create a User for SteamCMD:
Avoid running the game server as root for security reasons.
sudo adduser steam
sudo su - steam
Download and Install SteamCMD:
mkdir ~/steamcmd && cd ~/steamcmd
curl -sqL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar zxvf -
Install CS:S or CS:GO Server:
./steamcmd.sh +login anonymous +force_install_dir ../css +app_update 232330 validate +quit
./steamcmd.sh +login anonymous +force_install_dir ../csgo +app_update 740 validate +quit
Start the Game Server:
Use the respective start command for your game server. Here's an example for CS:GO:
cd ~/csgo
./srcds_run -game csgo -console -usercon +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2
Add EPEL Repository:
NGINX is available in the EPEL repository.
sudo dnf install epel-release -y
Install NGINX:
sudo dnf install nginx* htop -y
Start and Enable NGINX:
sudo systemctl start nginx
sudo systemctl enable nginx
Verify Installation:
Access your server's IP address or domain name from a web browser. You should see the default NGINX welcome page.
NGINX Open Source does not support UDP forwarding. For UDP load balancing, you will need NGINX Plus.
/etc/nginx/nginx.conf) and add the following inside the http block:outside of the http block
include /etc/nginx/conf.d/*;
stream {
# Server block for UDP proxy
server {
# Listen on a specific port (replace 8888 with your desired port)
listen 27015 udp;
# Forward datagrams to backend servers defined in the "upstream" block
proxy_pass upstream_servers;
# Optional: Send responses back to the client (default is off)
proxy_responses 1;
}
# Upstream block to define backend servers
upstream upstream_servers {
# Add multiple servers for load balancing (replace IP addresses and ports)
server 192.168.122.139:27015;
}
}
sudo systemctl reload nginx
For NGINX Open Source users, consider alternative methods for UDP traffic forwarding, such as using socat or iptables.
mkdir /home/nginx
cd /home/nginx
wget http://nginx.org/download/nginx-1.25.4.tar.gz
tar -zxvf nginx-1.25.4.tar.gz
cd nginx-1.25.4
./configure --with-stream --without-http_rewrite_module --without-http_gzip_module --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx
make ; make install