IMPORTANT NOTE: With the introduction of SteamCMD, the installation process is now slightly different.
First off, create a new user. It's not a good idea to operate as root if you don't have to, so I created a new user to run the server.
It will then ask you for some information about this user you are going to add. This is just about what mine looked like:
Full name: gamer
Vid (Leave empty for default):
Login group [gamer]: gamer
Login group is gamer. Invite gamer into other groups? :
Login class [default]:
Shell [sh]: bash
Home directory [/home/gamer]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: yes
Use empty password? (yes/no) [no]: no
Use a random password? (yes/no) [no]: no
Enter password: yourpassword
Enter password again: yourpassword
Lock out the account after creation? [no]: no
At this point, it will recap the user and ask if the information is correct. If it is, type yes
; if not, type no
, and then type yes
when prompted to create another user.
Now that you have created a user, you should create a directory in which to place the server. /usr is your biggest partition, so create it somewhere in there. Perhaps something like this:
Next, depending on where you actually put the directory, you may have the change the ownership of the directory
. To change that, use
chown -R gamer:gamer /usr/home/gamer/hlds
gamer:gamer is user:group (so if you chose a different username and/or group name, be sure to edit that accordingly) and -R makes it so that it changes the ownership of the directory and all subdirectories.
Now that you have created your user and your directory, you're ready to begin the actual installation.
Currently, the Half Life Dedicated Server Updatetool is located at http://store.steampowered.com/about/
. Down at the bottom, click on "Tools" and choose the Linux Updatetool
. If it's not located there by the time you read this tutorial (Steam may change around their site or something), just search the site for it - it's there somewhere.
I'll tell you what to do, and in green I'll explain what it's doing
# su gamer switch user to gamer
Password: Enter your password: it won't mirror your typing with ***, so don't be alarmed
$ cd /usr/home/gamer/hlds Move to the directory you'll be installing the server in
$ fetch http://storefront.steampowered.com/download/hldsupdatetool.bin This is the current link to download the HLDS software.
$ chmod +x hldsupdatetool.bin Changes the mode of the file to "execute", so you can execute the binary.
$ ./hldsupdatetool.bin ./ means the current directory, so in the current directory, you are executing hldsupdatetool.bin.
yes to accept the agreement
$ chmod +x steam again, changes "steam" so you can execute it
$ ./steam -command update -game czero -dir . Change "czero" to be whatever game you are installing, such as cstrike or dod. (I made a full list of possible mods here for future reference.) I always have to run this command three or four times before it's finished. Just continue running it until you get a finalized installation. This may take a while, depending on your connection speed.
Once this is completed, you have a very basic Counter Strike (or whatever game you installed) server. It has absolutely no plugins or anything.
You should now be able to launch your server. You do that with a command line. Be sure you are in the /usr/home/gamer/hlds directory (the directory in which you installed the server), and type the following, or any combination of the following:
./hlds_run -game czero -autoupdate +port 27015 +map de_dust2_cz +maxplayers 20
It doesn't really matter what order you put those things, as long as the -game part comes first. There are other things you can add - they're mentioned in applicable posts in the rest of the tutorial.
This is a full list of all the possible command line variables: link
Now that it's installed, check out some of these threads for more advanced configuration:
Configuring your server files
Adjusting your server rates
Installing AMX Mod X
Adding custom maps