HOW TO: HLDS & ESF Install

New Member
Joined
Dec 7, 2004
Messages
2
Best answers
0
The following tutorial should be easy to follow. I did not like the other tutorials I saw (not easy to follow for a newbie).

These instructions are assuming you have root access, basic knowledge of Linux, and are NOT on a FreeBSD box. If you need instructions how to set up your FreeBSD box, my email address can be found at the end of this HOW TO.

Login as root to continue.

1. Download and install HLDS

Make a directory to install your game into. For example, /home/halflife/esfserver (I personally use /home/halflife/xxx.xxx.xxx.xxx/accountname/hlds_l - with xxx being the IP assigned to that server(s))
Now some people are going to disagree here, but I believe a well formed directory structure is important. The next 6 or so commands is for setting up your server directory structure.

Code:
mkdir /home/halflife
Code:
cd /home/halflife
Code:
mkdir esfserver
Code:
cd esfserver
Code:
mkdir hlds_l
Code:
cd hlds_l
At this point our hlds_l directory, where we are going to install hlds and the esf mod, should be /home/halflife/esfserver/hlds_l
Code:
wget http://www.steampowered.com/download/hldsupdatetool.bin
Code:
chmod +x hldsupdatetool.bin
The following command will bring up a ToS. Type 'yes' when prompted.
Code:
./hldsupdatetool.bin
Create a steam account - change the values for your information
Code:
./steam -command create -username USER -email [email protected] -password PASSWORD -question "WHO AM I?" -answer GOD
Create an update script using the info from the account we created.
Code:
vi update (pico update or nano update if preferred)
Code:
#!/bin/sh
./steam -command update -game esf -dir /home/halflife/esfserver/hlds_l -username [email][email protected][/email] -password PASSWORD -remember_password
Set execute permissions on the file.
Code:
chmod +x update
./update
You may get the following message when doing './update'. If so, just do './update' again after the message.
Code:
Checking bootstrapper version ...
Getting version X of Steam HLDS Update Tool
Downloading. . . . . . . . . . .
Steam Linux Client updated, please retry the command
To be safe, do the following to make sure your flavor of linux can find the libraries.
Code:
export LD_LIBRARY_PATH=/home/halflife/esfserver/hlds_l:$LD_LIBRARY_PATH
2. Download and install ESF

Since ESF files are not linked directly (all on mirrors) you'll have to find a URL for them. (ie. http://url-to-files/esf12.tar.gz)
Code:
wget http://url-to-files/esf12.tar.gz
wget http://url-to-files/esf121.tar.gz
tar -zxvf esf12*.tar.gz
3. Start your server!

So far we have installed HLDS and the ESF mod. All that is left is to start our server. You can read on many different forums, many different ways to start/stop your HLDS server. I'll give you a few different examples.

a. Using Screen

With screen we can jump in out of the RCON console and start/stop the HLDS server with ease. I make use of scripts so I don't have to remember every command option.

Create a startup/restart script. Change <SESSION_NAME> to something more appropriate. (ie. esfserver01)
Code:
vi start (pico start or nano start if preferred)
Code:
#!/bin/sh
screen -r <SESSION_NAME> -X quit
echo Server has been restarted!
screen -A -m -d -S <SESSION_NAME> ./hlds_run -game esf +maxplayers 12 +map esf_cell_games
Create a shutdown script. Change <SESSION_NAME> to what you entered into the "start" script we created above.
Code:
vi stop (pic stop or nano stop if preferred)
Code:
#!/bin/sh
screen -r <SESSION_NAME> -X quit
echo Server has been stopped!
Set execute permissions on the files.
Code:
chmod +x start
chmod +x stop
Now we are ready to start our server!
Code:
./start
The neat thing about using screen is we can go back and forth between hlds consoles rather easy. We do this by attaching and detaching to the screen session we created (<SESSION_NAME>). Here is how to attach and detach and kill your hlds server.
attach:
Code:
screen -r <SESSION_NAME>
detach:
Code:
PRESS [i]CTRL + a[/i], release, PRESS [i]d[/i]
kill:
Code:
screen -r <SESSION_NAME> -X quit

b. Using &

This method is fairly simple to use also. As we did with the screen method above, we will make use of shell scripts.

Create a startup script. We are making use of '-pidfile <pid file name>' to put the Process ID of the server into a file. You can also see '> /dev/null 2>&1 &' at the end of our command line. The '> /dev/null 2>&1' redirects console messages from hlds to the trash (/dev/null). The '&' the very end simply tells the program to run in the background, which means you can exit your ssh/console/terminal session and still have the server run.

Code:
vi start (pico start or nano start if preferred)
Code:
#!/bin/sh
echo Server has been started!
./hlds_run -game esf +maxplayers 12 +map esf_cell_games -pidfile hlds.pid -norestart > /dev/null 2>&1 &
Create a shutdown script. We are going to make good use of the -pidfile option used in our start script.

Code:
vi stop (pic stop or nano stop if preferred)
Code:
#!/bin/sh
cat hlds.pid | xargs -l1 kill -9
echo Server has been stopped!
Now we are ready to start our server!
Code:
./start
b. Using method "b" and user accounts.

Methods "a" and "b" from above both run hlds as the root account. Now, IMHO this doesn't matter at all if you set your server up right. In any event, here is any easy way to run hlds as a specific user.

Create a user account specifically for the game server. In this instance we are creating a user "esfserver" with the password of PASSWORDFORACCOUNT with a home directory of /home/halflife/esfserver.
Code:
useradd -d /home/halflife/esfserver -p PASSWORDFORACCOUNT esfserver
Setup proper permissions.
Code:
chown -R efserver:efserver /home/halflife/esfserver
Create a startup script. Same as method "b" but running hlds with the ACCOUNTNAME we created. Change ACCOUNTNAME to what account name you created.
Code:
vi start (pico start or nano start if preferred)
Code:
#!/bin/sh
echo Server has been started!
su -c ACCOUNTNAME ./hlds_run -game esf +maxplayers 12 +map esf_cell_games -pidfile hlds.pid -norestart > /dev/null 2>&1 &
Create a stop script. Same as method "b".
Code:
vi stop (pic stop or nano stop if preferred)
Code:
#!/bin/sh
cat hlds.pid | xargs -l1 kill -9
echo Server has been stopped!
Now we are ready to start our server!
Code:
./start

Not EVERY version of linux has the same command structure, therefore, the above methods may or may not work. RedHat users this should work just fine on. For those of you who use FreeBSD (good choice, i only use it) there are quite a few more steps that are needed. If you would like any more tutorials written, or need help with something, please contact me at xanthas[AT]gmail[DOT]com. <-- @ .

This tutorial is my own creation. I run an established Game Server Provider company (LLC) so I have a wealth of experience in this category.
 
New Member
Joined
Dec 2, 2004
Messages
12
Best answers
0
I think it looks like an enchanced copy of my guide, especially in the start...

But it's good anyway, well done.
 
New Member
Joined
Dec 7, 2004
Messages
2
Best answers
0
well, obviously setting up hlds + mod(s) are always going to be the same, albeit little differences here and there
 
New Member
Joined
Dec 2, 2004
Messages
12
Best answers
0
Yeh of course, I just think that the one I made is much easier for newbies! :-D
This one is far more complete though, well done!
 

Users who are viewing this thread

Top Bottom