How to Download and Install HLDS (Half-Life Dedicated Server)

How to Download and Install HLDS (Half-Life Dedicated Server)

In this tutorial, we'll walk through how to download and install HLDS using SteamCMD, both on Windows and Linux. HLDS is a dedicated server application for games like Counter-Strike 1.6, Half-Life, Team Fortress Classic, and others. We’ll break the process down into sections for Windows and Linux installations, as the steps differ slightly.

Windows Installation

To install HLDS on Windows, we will use SteamCMD (Steam Console Client), a command-line tool designed to install and update various dedicated servers available on Steam.

Step 1: Download and Extract SteamCMD

  1. Download SteamCMD from the official website: SteamCMD download link.
  2. Extract the contents into a folder of your choice, such as C:\steamcmd.

Step 2: Running SteamCMD

  1. Navigate to the folder where you extracted SteamCMD.
  2. Double-click steamcmd.exe to run it. This will open a command prompt window and begin updating SteamCMD.

Step 3: Setting Installation Directory for HLDS

Once SteamCMD has updated, it’s time to set the directory where you want to install HLDS.

  1. In the SteamCMD window, set the installation directory using the following command:
    force_install_dir C:\hlds
Installing SteamCMD

Step 4: Log in to SteamCMD

You can either log in with your personal Steam account or use anonymous login (which is sufficient for most GoldSrc servers like Counter-Strike 1.6 or Half-Life). To log in anonymously, type:

login anonymous

Step 5: Install HLDS

To download and install the HLDS files, use the following command:

app_update 90 validate

This command will download the base files for Half-Life and Counter-Strike 1.6 (HLDS is the platform that runs these games). You may need to run this command a couple of times if it doesn’t download everything on the first try. This is due to a common bug in SteamCMD that can prevent some files from being downloaded on the first pass.

Installing SteamCMD

Step 6: Additional Game Mods (Optional)

If you want to install other mods (like Team Fortress Classic, Opposing Force, or Day of Defeat), use the following commands. For example, for Team Fortress Classic:

app_set_config 90 mod tfc
app_update 90 validate

Here are some other popular mods and their corresponding commands:

  • Opposing Force (gearbox):
    app_set_config 90 mod gearbox
    app_update 90 validate
  • Day of Defeat (dod):
    app_set_config 90 mod dod
    app_update 90 validate
  • Deathmatch Classic (dmc):
    app_set_config 90 mod dmc
    app_update 90 validate

Step 7: Launching HLDS

To run HLDS, use the following commands depending on your preference:

  • From the command line:
    hlds.exe -console -game valve +sv_lan 0 +maxplayers 22 +map undertow
  • Using the hlds_run script (if you have it):
    ./hlds_run -game valve -autoupdate -port 27016 +maxplayers 20 +map undertow

How to Download and Install HLDS Linux (Half-Life Dedicated Server)

Linux Installation

On Linux, the process is similar, though it uses different commands for setting up SteamCMD and HLDS. Below are the steps for a basic HLDS installation on Linux.

Step 1: Install SteamCMD

1. Install dependencies:

  • On Debian/Ubuntu:
    sudo apt-get update
    sudo apt-get install lib32gcc1 steamcmd
  • On Fedora:
    sudo dnf install steamcmd

2. Alternatively, you can manually install SteamCMD by downloading it from the official site and extracting it to a directory of your choice.

Step 2: Running SteamCMD

  1. Once SteamCMD is installed, open a terminal and run:
    steamcmd
  2. SteamCMD will automatically update itself.

Step 3: Set Installation Directory for HLDS

  1. Inside the SteamCMD prompt, set the installation directory:
    force_install_dir ./hlds
  2. This installs HLDS in a directory called hlds in the current working directory. You can change the path to any location where you want to install HLDS.

Step 4: Log in to SteamCMD

Log in using the anonymous account:

login anonymous

Step 5: Install HLDS

1. Now you can download and install HLDS (Counter-Strike 1.6, Half-Life, etc.) using the following command:

app_update 90 validate

2. If you want to install other mods, follow the same steps as for Windows (use the appropriate mod name, e.g., mod tfc, mod dod, etc.).

Step 6: Launching HLDS on Linux

Once the installation is complete, you can launch HLDS with the following command:

  • Running HLDS:
    ./hlds_run -game valve +sv_lan 0 +maxplayers 22 +map undertow

Creating a Launch Script (server.sh)

You can also create a launch script called server.sh and have it run the following code:


#!/bin/bash
./hlds_run -console -game valve -port 27015 -autoupdate +map crossfire +maxplayers 24 +ip 01.01.02.299 -strictportbind -tos -sys_ticrate 128 -condebug -debug

Troubleshooting

  • Missing Files on First Install: If the installation seems incomplete or HLDS doesn’t launch after the first attempt, re-run the app_update 90 validate command until all files are downloaded properly.
  • Port Issues: If HLDS doesn't connect properly, make sure that your firewall is allowing traffic through the port you’ve selected (default is 27015).

Conclusion

Congratulations, you've successfully installed HLDS using SteamCMD! Whether you're hosting a server for Counter-Strike 1.6, Half-Life, or any other GoldSrc game, you're now ready to run your dedicated server. If you run into any issues or need additional help, be sure to check the official SteamCMD documentation or the specific game’s community for troubleshooting tips.