Skip to content

Installing HLDS

Oct 11, 2005 Guides Posted by sook
HLDS running on Linux Terminal

How To Install HLDS (Half-Life Dedicated Server)

In this guide I will go through how to download, install and configure HLDS using SteamCMD on both Windows and Linux. HLDS is the dedicated server software used by Half-Life and other GoldSrc games such as Counter-Strike 1.6 and Team Fortress Classic.

The installation itself is fairly straightforward once SteamCMD is set up. I have covered Windows and Linux separately below, followed by some basic server configuration which applies to both.

Before You Start

  • You will need enough free disk space for the server files. Around 2 GB should be more than enough for a basic Half-Life installation.
  • On Linux you should be reasonably comfortable using the terminal. On Windows you will need to use the command prompt or SteamCMD console.
  • If the server will be available over the internet, make sure the required server port is allowed through your firewall. HLDS normally uses UDP port 27015.
  • If the server is behind a router, you may also need to forward the server port to the computer running HLDS.

Windows Installation

Step 1: Download SteamCMD

Download SteamCMD and extract it somewhere convenient. For example:

C:\steamcmd

Step 2: Run SteamCMD

Open the SteamCMD folder and run steamcmd.exe. The first time it starts it may download additional files and update itself.

Step 3: Set the Installation Folder

Choose where you want HLDS to be installed. In this example I am using C:\hlds.

force_install_dir C:\hlds

Step 4: Log In

HLDS can be downloaded using an anonymous Steam login:

login anonymous

Step 5: Install HLDS

Half-Life Dedicated Server uses Steam App ID 90. Run the following command to download and validate the server files:

app_update 90 validate

SteamCMD can occasionally fail to download every file on the first attempt. If anything appears to be missing, simply run the same command again.

Once the installation has completed you can leave SteamCMD with:

quit

Step 6: Install an Additional Game

If you are installing a game such as Team Fortress Classic, you can tell SteamCMD which game you want before running the update again.

app_set_config 90 mod tfc
app_update 90 validate

If you only want to run standard Half-Life deathmatch, you do not need to do this.

Step 7: Start the Server

Once the installation has finished, open the HLDS folder and start the server from the command line. For example:

hlds.exe -console -game valve -port 27015 +sv_lan 0 +maxplayers 22 +map undertow

This starts a standard Half-Life internet server on port 27015 with a maximum of 22 players and loads the map undertow.


Linux Installation

Step 1: Install SteamCMD

SteamCMD and HLDS still rely on 32 bit components, so these need to be available on a modern 64 bit Linux installation.

On Debian or Ubuntu based systems you can enable 32 bit support and install SteamCMD with:

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install lib32gcc-s1 steamcmd

On Ubuntu, if the steamcmd package cannot be found, you may need to enable the Multiverse repository first:

sudo add-apt-repository multiverse
sudo apt update
sudo apt install steamcmd

Other Linux distributions may package SteamCMD differently, so check the documentation for your distribution or the official SteamCMD documentation if the package is not available.

Using a Dedicated Linux Account

If this is a permanent server, I would recommend running HLDS using a dedicated Linux account rather than running the game server as root.

For example:

sudo adduser steam
sudo su - steam

You can then keep SteamCMD and the HLDS installation inside that user’s home directory.

Step 2: Run SteamCMD

steamcmd

Step 3: Set the Installation Folder

Choose where you want the server files to be installed. For example:

force_install_dir ./hlds

Step 4: Log In

login anonymous

Step 5: Install HLDS

app_update 90 validate

As with Windows, if SteamCMD appears to have missed any files, run the command again.

When the installation has completed, leave SteamCMD with:

quit

Step 6: Start the Server

Once HLDS has finished installing, you can start a standard Half-Life server with:

./hlds_run -game valve -port 27015 +sv_lan 0 +maxplayers 22 +map undertow

Optional Launch Script

If you are going to run the server regularly, it is easier to create a small launch script rather than typing the full command each time.

Create a file called server.sh inside the HLDS folder and add:

#!/bin/bash
./hlds_run -game valve -port 27015 +sv_lan 0 +maxplayers 24 +map crossfire

Make the script executable:

chmod +x server.sh

You can then start the server with:

./server.sh

Understanding the Launch Command

The launch command can look a little confusing at first, but most of the options are fairly simple.

-game valve tells HLDS to run standard Half-Life. If you are running another GoldSrc game or mod, this value will be different.

-port 27015 sets the network port used by the server. The normal default is 27015.

+sv_lan 0 allows the server to operate as an internet server rather than restricting it to the local network.

+maxplayers 22 sets the maximum number of players.

+map undertow tells HLDS which map to load when the server starts.

On Windows, -console starts HLDS in console mode rather than using the graphical interface.

Basic Server Configuration

Most of the normal server settings belong in server.cfg rather than in the launch command.

For standard Half-Life this file belongs inside:

valve/server.cfg

If the file does not already exist, you can create it using a normal text editor.

A very basic configuration might contain:

hostname "My Half-Life Server"
rcon_password "change_this_to_a_strong_password"
sv_lan 0

The hostname is the name players will see for your server.

The RCON password allows remote administration of the server. Make sure you change the example above to a strong password and do not reuse a password from another account or service.

Most additional game and server settings can also be added to server.cfg, along with settings required by server side mods or plugins.

Setting the Map Rotation

The normal map rotation is stored in mapcycle.txt inside your game folder.

For standard Half-Life this will normally be:

valve/mapcycle.txt

Add one map name per line without the .bsp extension. For example:

crossfire
undertow
stalkyard
bounce

Any custom maps listed here will also need to exist inside the server’s maps folder.

Keeping HLDS Updated

It is worth checking for server updates from time to time, particularly after Half-Life itself receives an update.

I prefer to stop the server and update it through SteamCMD rather than relying on automatic updating.

Open SteamCMD and use the same installation directory that you used when the server was first installed.

Windows:

force_install_dir C:\hlds
login anonymous
app_update 90 validate
quit

Linux:

force_install_dir ./hlds
login anonymous
app_update 90 validate
quit

The validate option checks the existing installation and downloads any missing or changed files.

Making the Server Available Online

If the server works locally but nobody outside your network can connect, the problem is normally related to the firewall or router rather than HLDS itself.

Make sure UDP port 27015, or whichever port you selected with -port, is allowed through the firewall on the server.

If the server is behind a home router, you may also need to forward that UDP port to the local IP address of the computer running HLDS.

Also make sure the server is using:

sv_lan 0

If sv_lan is set to 1, the server is intended for local network play.

Troubleshooting

If files appear to be missing or the server behaves strangely after an update, the first thing I would try is running the validation command again:

app_update 90 validate

If players cannot connect to the server, check the firewall, router and port forwarding settings. Make sure the UDP game port matches the port being used in the HLDS launch command.

If the server starts but does not appear publicly, check that sv_lan is set to 0. Also make sure you have not started HLDS with -nomaster, as this prevents communication with the master server.

If HLDS will not start at all on Linux, check that you are running the command from the correct installation folder and that the required 32 bit libraries are installed.

If a Linux launch script gives a permission denied message, make sure it has been made executable with:

chmod +x server.sh

If the wrong game or mod starts, check the value being passed to -game. Standard Half-Life uses valve.

Where To Go Next

At this point you should have a working Half-Life Dedicated Server, a basic configuration and a map rotation in place.

From here you can start adding custom maps, changing the gameplay settings in server.cfg and setting the server up the way you want it.

If you want to add server plugins or additional server side features, the next step will usually be installing Metamod. From there you can either install native Metamod plugins or add AMX Mod X for a much larger range of plugins and administration tools.

You can also find more information in the SteamCMD documentation.

Summary

  • Half-Life Dedicated Server uses Steam App ID 90
  • The normal game port is UDP 27015
  • HLDS can be installed on Windows and Linux using SteamCMD
  • Standard Half-Life uses -game valve
  • An anonymous Steam login can be used to download the server files
  • General server settings belong in server.cfg
  • The normal map rotation is stored in mapcycle.txt
  • Use app_update 90 validate to update or repair the installation
  • Metamod is the usual next step if you want to add server plugins