Menu

Ubuntu24_HLDS_Install

🛠️ Updated Guide: CS 1.6 Server Installation with Custom Script (Ubuntu 24.04 LTS)

This documentation details the process for installing and configuring a Counter-Strike 1.6 Dedicated Server (HLDS) on **Ubuntu Server 24.04 LTS (64-bit)**.

Since the CS 1.6 server uses 32-bit binaries, this guide includes the installation of necessary 32-bit compatibility libraries and the subsequent service management using a dedicated systemd script.


1. Essential Dependencies and Requirements

The 64-bit architecture of Ubuntu 24.04 mandates the enabling of the i386 architecture to successfully execute the HLDS engine.

Execute all following commands as a user with sudo permissions.

1.1 Enable Architecture and Update

It is **critical** to enable the 32-bit architecture before installing dependencies.

# 1. Enable the 32-bit architecture (i386), CRITICAL for CS 1.6
sudo dpkg --add-architecture i386

# 2. Update the package list and upgrade the system
sudo apt update && sudo apt upgrade -y

1.2 Install Compatibility Libraries

Install basic system utilities and essential 32-bit libraries (i386).

# 3. Install System Utilities
sudo apt install wget curl tar mailutils unzip nano tmux net-tools binutils -y

# 4. Install 32-bit Libraries required by HLDS
sudo apt install lib32gcc-s1 lib32z1 libbz2-1.0:i386 libc6:i386 libncursesw6:i32 libstdc++6:i386 libgcc-s1:i386 -y

# 5. Install Additional Libraries for GoldSrc engine dependencies
sudo apt install libsdl2-2.0-0:i32 libfontconfig1:i32 libxtst6:i32 -y

2. Service User Creation and Configuration

For security best practices, the server must run under a dedicated, non-root account (csserver).

  1. **Create the User and Set Password:**
    sudo useradd csserver
    sudo passwd csserver

    A strong password should be set for the account.

  2. **Create Home Directory and Assign Ownership:**
    sudo mkdir /home/csserver
    sudo chown csserver:csserver /home/csserver
  3. **Switch to the Service User:**
    su - csserver
    Warning: All remaining steps must be executed as the csserver user unless explicitly stated otherwise.

3. Server Installation and Binary Validation

A preconfigured package is used, followed by a validation step using SteamCMD to ensure binary compatibility with Ubuntu 24.04.

3.1 Initial Download and Extraction

Execute as csserver.

# Download the preconfigured package
wget "https://downloads.sourceforge.net/project/cs16serverpreconfiguredlinux/beta2014/linuxserver%2BdprotoDualnosteam.tar.gz"

# Unpack the contents, creating the /home/csserver/27020 directory
tar xvzf linuxserver+dprotoDualnosteam.tar.gz

3.2 Binary Correction and Validation (SteamCMD)

SteamCMD is used to download the latest HLDS binaries, ensuring compatibility.

Execute as csserver.

  1. **Download SteamCMD:**
    wget "http://media.steampowered.com/client/steamcmd_linux.tar.gz"
  2. **Unpack and Assign Execution Permissions:**
    tar xvfz steamcmd_linux.tar.gz
    chmod +x steamcmd.sh
  3. **Run SteamCMD and Validate Installation:**
    ./steamcmd.sh

    Inside the SteamCMD console, execute the following commands:

    force_install_dir /home/csserver/27020/
    login anonymous
    app_update 90 validate
    exit

3.3 Library Compatibility Fix

To prevent conflicts between old packaged libraries and modern system libraries, the conflicting files are renamed, forcing the system to use its newer libraries.

Execute as csserver inside the server directory.

cd /home/csserver/27020

# Rename old libraries (backup)
mv libstdc++.so.6 libstdc++.so.6.BAK
mv libgcc_s.so.1 libgcc_s.so.1.BAK

# Create symbolic link for steamclient.so
mkdir -p ~/.steam/sdk32
ln -s /home/csserver/linux32/steamclient.so ~/.steam/sdk32/steamclient.so

4. Server Execution

4.1 Obtain Server IP Address

Determine the server's public IP address for use in the startup parameters.

curl ifconfig.me

4.2 Manual Execution (Testing)

Replace XXX.XXX.XXX.XXX with the public IP address obtained.

Note: You can use your **LAN IP** for local network testing, but the **Public IP** is mandatory for friends and players outside your local network to connect.
cd /home/csserver/27020
./hlds_run -game cstrike +ip XXX.XXX.XXX.XXX +port 27020 -pingboost 3 +maxplayers 22 +map de_dust -autoupdate

To stop the server: Press Ctrl + C.

4.3 Background Execution with screen

To run the server detached from the terminal (temporary):

screen -A -m -d -S csserver \
./hlds_run -game cstrike +ip XXX.XXX.XXX.XXX +port 27020 -pingboost 3 +maxplayers 22 +map de_dust -autoupdate &
  • **To attach (view console):** screen -r csserver
  • **To detach (leave running):** Ctrl + A then D

5. systemd Service Installation

A dedicated script is used to install and enable the service unit for persistent operation.

  1. **Download the Service Installer Script:**

    Execute as csserver.

    cd /home/csserver
    wget "https://downloads.sourceforge.net/project/cs16serverpreconfiguredlinux/beta2014/systemd/install_cstrike_service.sh"
  2. **Assign Permissions and Run Installer:**

    Execute as sudoer (requires sudo).

    sudo chmod +x /home/csserver/install_cstrike_service.sh
    sudo /home/csserver/install_cstrike_service.sh
    Note: This script installs the cstrike_server.service unit file and enables it for automatic startup.
  3. **Verify Service Status:**

    Execute as sudoer.

    sudo systemctl status cstrike_server

6. Network and Firewall Requirements

The following UDP ports must be open on the host firewall and forwarded on your network router:

Port (UDP) Function
**27005** Server monitoring and status
**27020** Primary game communication (matching the +port setting)

7. Optional Configuration (DProto - Dual Protocol)

DProto is **optional** and is only required if you need to support both Steam and Non-Steam clients connecting to your server. If you only plan to host for official Steam clients, you can skip this section.

  1. **Create and Download DProto Configuration:**

    Execute as csserver.

    cd /home/csserver/27020
    touch dproto.cfg
    
    # Primary Source (Recommended)
    wget -O dproto.cfg "https://downloads.sourceforge.net/project/cs16serverpreconfiguredlinux/beta2014/dual_protocol/dproto.cfg"
    
    # Alternative Source (Backup)
    # wget -O dproto.cfg "https://pastebin.com/raw/crb5bNk5"
  2. **Add Client Rejection Message to server.cfg:**

    Add the following line to /home/csserver/27020/cstrike/server.cfg:

    dp_rejmsg_nosteam47 "Sorry, you're using an old client, download a newer version."

References

This guide is based on established HLDS deployment procedures and updated for current Ubuntu versions, adhering to standards similar to those used by LinuxGSM.