|
Introduction
|
|
This guide has been updated for NS 2.0! It uses the HLDS_L server 3.1.1.0 and shows you how to install the boffix_i386.so patch which fixes the buffer overflow attack.
Okay, I've seen this asked a couple times so I decided to write up a Newbie Guide on how to set up a RedHat Linux server with Natural Selection 2.0. While my examples some of my RPM installation examples are RedHat specific, the main server install is Linux Distribution independent.
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
|
|
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. 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:
hlds_l_3110_full.bin (120MB) - Location: check redphive.org
hlds_l_3110c_beta.tar.gz (Update patch, 970 KB) - Location: HERE
boffix_package.tar.gz (DoS attack and download any file from server fix, 4 KB) - Location: Get it from my server http://www.vadakill.com/files/boffix_package.tar.gz
ns_v2_dedicated_server.zip (91MB) - Location: Check downloads page on natural-selection.org
ns-201.zip - Location: http://files.redphive.org/ns/ns-v201.zip
Now that you have downloaded these files you need to put them in the correct locations.
When you have an hlds_l_3110_full.bin or any .bin file, you will need to run it first. To do this you'll need to change it to an executable file by:
|
Code
|
chmod 755 hlds_l_3110_full.bin
|
|
Then you'll need to run it by:
|
Code
|
./hlds_l_3110_full.bin
|
|
This should give you a license agreement screen, you'll have to agree to it and then it will extract itself and give you "hlds_l_3110_full.tar.gz" which you can then extract with the next step.
|
Code
|
tar zxvf hlds_l_3110_full.tar.gz
|
|
You should now have an hlds_l directory. Now you need to patch it to the latest HLDS version to fix some of the little bugs especially with VAC updating. From the same location type the following command:
|
Code
|
tar zxvf hlds_l_3110c_beta.tar.gz
|
|
Your hlds_l server files should now be up to date. One of the new problems that has cropped up was a buffer overflow exploit. This exploit would cause the hlds server to stop responding and get thrown into an infinite loop. To prevent this we need to install the boffix_i386.so patch to protect the server from this buffer overflow exploit.
|
Code
|
cd hlds_l
cp ../boffix_package.tar.gz .
tar zxvf boffix_package.tar.gz
|
|
The package you extracted is just the boffix_i386.so file and the hlds_run file that I had already modified. It's easier for me to do that for this guide as it saves about a page of explaination. Now we move the Natural-Selection files into our current directory.
|
Code
|
mv ../ns_v2_dedicated_server.zip .
|
|
Now extract the Natural Selection server files. (NOTE: Do NOT use "unzip -a" to extract the NS 2.0 server files):
|
Code
|
unzip ns_v2_dedicated_server.zip
|
|
Now copy the Ns 2.01 server update to the ns/dlls folder and extract it.
|
Code
|
cp ../ns-v201.zip ns/
cd ns/
unzip ns-v201.zip
|
|
Remove some of the extraneous files:
|
Code
|
rm ns-v201.zip
rm dlls/ns.dll
|
|
|
Whew! the hard part is over! Now we need to do a little 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:
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_eclipse
|
|
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_eclipse
|
|
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.
Well, that's basically it. There are a few things not covered in this guide such as properly setting up port forwarding for your router (if behind a router/firewall) and setting up AdminMod but it does cover the basics. Maybe I'll write up other guides as I have the time. Feel free to make corrections where needed as I've done a large part of this from memory.
Good luck!
|
|