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.
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
The following command will bring up a ToS. Type 'yes' when prompted.
Create a steam account - change the values for your information
Create an update script using the info from the account we created.
Set execute permissions on the file.
You may get the following message when doing './update'. If so, just do './update' again after the message.
To be safe, do the following to make sure your flavor of linux can find the libraries.
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)
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)
Create a shutdown script. Change <SESSION_NAME> to what you entered into the "start" script we created above.
Set execute permissions on the files.
Now we are ready to start our server!
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:
detach:
kill:
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.
Create a shutdown script. We are going to make good use of the -pidfile option used in our start script.
Now we are ready to start our server!
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.
Setup proper permissions.
Create a startup script. Same as method "b" but running hlds with the ACCOUNTNAME we created. Change ACCOUNTNAME to what account name you created.
Create a stop script. Same as method "b".
Now we are ready to start our server!
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.
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
Code:
wget http://www.steampowered.com/download/hldsupdatetool.bin
Code:
chmod +x hldsupdatetool.bin
Code:
./hldsupdatetool.bin
Code:
./steam -command create -username USER -email [email protected] -password PASSWORD -question "WHO AM I?" -answer GOD
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
Code:
chmod +x update
./update
Code:
Checking bootstrapper version ...
Getting version X of Steam HLDS Update Tool
Downloading. . . . . . . . . . .
Steam Linux Client updated, please retry the command
Code:
export LD_LIBRARY_PATH=/home/halflife/esfserver/hlds_l:$LD_LIBRARY_PATH
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
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
Code:
vi stop (pic stop or nano stop if preferred)
Code:
#!/bin/sh
screen -r <SESSION_NAME> -X quit
echo Server has been stopped!
Code:
chmod +x start
chmod +x stop
Code:
./start
attach:
Code:
screen -r <SESSION_NAME>
Code:
PRESS [i]CTRL + a[/i], release, PRESS [i]d[/i]
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 &
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!
Code:
./start
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
Code:
chown -R efserver:efserver /home/halflife/esfserver
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 &
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!
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.