HLDS Guides for Newbies
Created by Vadakill
 
Introduction

This guide will walk you through creating a steam account for your server, downloading the core files and then extracting and configuring your NS installation for basic operation.

For better or for worse steam is here and is here to stay. Once the WON servers go down for good there will be no other way to authenticate Half-life, Counter-Strike and Day of Defeat Retail users to play on your servers. As you may or may not know the auth server is important for two main reasons. First, it allows you to ban users who are disruptive to your environment, second when Valve Anti-Cheat (VAC) becomes available for NS it will allow you to use the updated modules to help fight cheating.

Once I'm done installing my Linux box and securing it I usually never log into the console again. It sits in a corner with no monitor, no keyboard and has only two wires coming from it, the power cord and an Ethernet cable. All administration on my Linux server is done through SSH using the putty client found here:

PuTTY: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

You'll want to set up putty on your windows machine and make sure you can log into your Linux box using SSH. This way you can always get to it from where ever you may be. If you are behind a DSL/Cable router you'll need to forward port 22 to your Linux box to reach it from the outside.

Most people will have a user account that they will be setting the server up under. It is not a good idea to be running an hlds server as "root", just to be safe. A user account is usually something like "/export/home/username" or "/home/username"; in any case I will be referring to this place as your "home directory"
 
Preparing for Install

Note: I use RedHat 7.3 for my server so some of the examples dealing with "RPM" are redhat specific. They may not apply if you are using another distro such as Mandrake, SuSe, Debian, Slackware or others.

One thing that may make this process easier is if you have a text only web browser called "lynx". This will be your best friend for most of this setup process. You may also need "unzip" in order to apply some patches. If you are not sure if you have "lynx" and "unzip" try typing 'lynx' or 'unzip' at the command prompt and see if something happens. If it tells you "command not found" then you will need to download and install the proper RPM packages. Below are some places to find these packages:


Lynx is found here: http://www.rpmfind.net/linux/rpm2html/search.php?query=lynx
Unzip is found here: http://www.rpmfind.net/linux/rpm2html/search.php?query=unzip

You'll need to download the RPM package for your particular distribution and install it using the RPM command. Make sure you download the RPM not the source RPM (SRPM or SRC).
 
Code wget http://URL-HERE/filename.rpm

To install the packages you will then have to be logged in as ROOT in order to install them. Use the command for both lynx and unzip packages.
 
Code rpm -Uvh filename.rpm

Once both are installed you should be able to type "lynx" and "unzip" at the command prompt to get either a lynx web browser (Q to quit) and a short help on the usage of unzip respectively.
 
Downloading the Proper Files

First thing you should do make sure your logged in as your user account, not as root. You'll want to download the server files onto your machine so that they can be extracted and set up. There are a ton of mirror sites for these files but one I use often is redphive.org. I find that they are very fast and have excellent file integrity. You can download via FTP or HTTP by using lynx or wget, it doesn't really matter. How I usually do things is, I use my windows PC to copy URL and then I open up lynx, hit "g", and then paste the URL into lynx, it should then download the file. Lynx will save the file to whatever location you are currently in when you started it, keep this in mind. You can also use wget like the exmaple above, just copy and paste the URL you want to download.

Make sure you are logged in as your user account and in your home directory, then download the following files using lynx or wget:

hldsupdatetool.bin (2.84 MB) - Location: ftp://hlserver:hlserver@ftp.valvesoftware.com/linux/hldsupdatetool.bin
ns_v3_b5_dedicated_server.zip (146 MB) - Location: Check downloads page on natural-selection.org

 
Setting Up a Directory Structure and Extracting the Base Server File

Now that you have all the files in your home directory needed for the install we need to go through setting up the directory structure and extracting the files in the proper locations.

First, we need to extract the steam binary so we can get on with the core Half-Life Dedicated Server (HLDS) installation. To do this we'll need to issue a few commands to get the .bin(ary) file into a form where we can run it. We'll change the mode of the file to an executable by issuing the following command:
 
Code chmod 755 hldsupdatetool.bin

Now we need to run the file:
 
Code ./hldsupdatetool.bin

This will give you a license agreements screen. Type "yes" and hit enter to agree to the license and extract the steam file. Good, once that's done we need to prepare a directory to store the HLDS files that we will be downloading in a few minutes. (NOTE: If you get a Message "sh: line 1: uncompress: command not found, Broken pipe" see trouble shooting section at the end of this guide)

So now we're going to make a place to download all the steam files needed for the core HLDS server. I like the classic naming convention of hlds_l for my storage directory. That is what I'm used to so that's what I created.
 
Code mkdir hlds_l

Next, we change into the hlds_l directory and copy the "steam" file to it.
 
Code cd hlds_l
cp ../steam .

Now we'll need to create a steam account for the server, see the next section:
 
Setting up a Linux Steam Account

Just like for the client, you will need to create an account for your server. It's not too difficult as long as you pay close attention to how the command line is formed. There are two separate methods of creating an account, the old method and the "new improved" method. The first method I describe is the old steam updater method:

    steam -create {username} {password} {question} {answer}

Here is an example of how I would create an account for my server using the old method:
 
Code ./steam -create server@vadakill.com myPa$$w0rd "My dog's name is?" woofy

If all goes well it should mention that the "Account was created successfully"

The new method is a little more elaborate and requires a bit more typing, here's how you would create an account with the new method:
 
Code ./steam -command create -username server@vadakill.com -email server@vadakill.com -password myPa$$w0rd -question "My dog's name is?" -answer woofy

 
Downloading, Extracting and Updating HLDS and NS

Next we will need to actually get the HLDS core files needed to run the server.
 
Code ./steam -update valve . server@vadakill.com myPa$$w0rd Y

This could take 15 minutes or several hours depending on how much bandwidth you have and how busy the steam content servers are. Doing it this way ensures that you have the latest, most up-to-date server files. (NOTE: If you get a message that contains "ContentServer rejected client's protocol version", please check the trouble shooting section at the end of the guide for a fix)

IMPORTANT NOTICE: You may have noticed that it said the above command structure is deprecated. The most recent steam patch has changed the command structure quite a bit. Below is an example of how you would update the server in the future, you may want to run this command once after you update just to make sure everything is fully upgraded to the latest version.
 
Code ./steam -command update -game valve -dir /home/hlds/hlds_l -username server@vadakill.com -password myPa$$w0rd -remember_password


Once it's done downloading you should move the NS 3.0 server file into your current directory and extract it. (NOTE: Do NOT use "unzip -a" to extract the NS 3.0 server files):
 
Code cp ..ns_v3_b5_dedicated_server.zip .
unzip ns_v3_b5_dedicated_server.zip

...then remove the .zip archive since it's taking up space and we won't need it anymore:
 
Code rm ns_v3_b5_dedicated_server.zip

That should do it! The basics are all taken care of, now you just need to do a little custom configuration.
 
Custom Configuration

You should now edit the server.cfg file and replace the default hostname with one you want such as "Bobo's Love shack" or whatever. Vi can be difficult to use at first but you will quickly get used to it. Some simple commands to get you started:
  • To escape or turning off any mode you are in you can just hit the ESC key twice.
  • To begin typing information press the "i" key until an "--insert--" appears near the bottom of the screen. Hit ESC to get out of this mode.
  • To delete a single line make sure your out of any other mode by hitting "ESC" and then type "dd"
  • To delete 10 lines, make sure your out of any other mode by hitting ESC and then type "d10d"
  • To go to the beginning of your file type "gg", to go to the end hold down SHIFT GG
  • To go to a specific line do SHIFT G, the line number then SHIFT G again.
  • To save your file and quit vi do, SHIFT ZZ
  • To undo the last mistake you made do ":u"
  • If you made a lot major mistakes and you want to quit without saving your file, do ":q!"
To edit your server.cfg file:
 
Code vi server.cfg

After you are done editing your server.cfg file, press SHIFT ZZ to save and close the document.

You should be able to start your server after this. Change directory back to you hlds_l directory and then type:
 
Code ./hlds_run -game ns +exec server.cfg +ip xxx.xxx.xxx.xxx +maxplayers 12 +map ns_nancy

If the server starts you should then be able to type "stat" in the console and it should feedback to you some server statistics like, map, players, server build, etc...

This is all well and good but as soon as you close your console the hlds server process will stop. So how to we prevent this? Many admins don't like screen, but I use it. Screen allows you to start a virtual console, and then view it (attach) and hide it (detach) at your choosing. To start an hlds server using screen you would run the following command:
 
Code screen -A -m -d -S ns ./hlds_run -game ns +ip xxx.xxx.xxx.xxx +maxplayers 12 +map ns_nancy

You can then attach the screen by typing "screen -x ns" and hitting enter. You should now be able to see the server output. To detach the screen and have it go back to running in the background you would hold "CTRL" then press "a", then release "CTRL" and hit "d" to detach.

 
Trouble Shooting
This is a list of common error messages that have been seen while trying to setup or update a steam server:
 
Error Message: Enter 'yes' to accept this agreement, 'no' to decline: yes
sh: line 1: uncompress: command not found
Broken pipe

This one is pretty common. This occurs if the command "uncompress" is not found in it's default location or the uncompress command on your server is called something else. This error is usually fixed by running the following command as root.
 
Code ln -s /usr/bin/gunzip /usr/bin/uncompress

--------------

 
Error Message: Checking bootstrapper version ...
Updating Installation
No installation record found at /home/hlds/hlds_l
Updating 'Linux Server Engine' from version 0 to version 6
ContentServer rejected client's protocol version

This Error usually only occurs when there has been a previous steam server on the system but the administrator removed it and wanted to start from scratch. Steam places a hidden folder in the user's home directory called ".steam". The "." in front of the "steam" folder tells the file system that this is a hidden file to prevent accidental deletion. If you are starting from scratch you can wipe this directory out safely. To do this you can run the following command as the user you typically run your server under:
 
Code rm -rf ~/.steam