Set-up you own custom server.Introduction
Have you been playing Counter-Strike and you now want to set up your own dedicated server? Or are you just curious how a dedicated server works? Those questions come up all the time in Counter-Strike communities all over the world. Many of you probably think it's a very complicated process, but in fact, it is more time consuming rather than complicated.
Short explanation of the dedicated server components
A Counter-Strike 1.6 dedicated server isn't just one piece of software that works out-of-the-box but it's rather a combination of software packages that work together, as one. These are a dedicated server's components:
HLDS - Stands for Half-Life Dedicated Server and contains the Half-Life game engine, files and other things needed for our dedicated server.
Counter-Strike 1.6. - This game is in fact, just a MOD (Modification) for the game Half-Life.
MetaMOD Is a plugin/DLL which hooks up to a Half-Life MOD and can run many plugins at once. For example, if you don't have an Internet connection but still want to run a HLDS, MetaMOD allows you to run an administrative plugin and a bot plugin at the same time. A bot is actually a roBOTic computer controlled entity that simulates actual players in a game.
AMXModX Is a MetaMOD plugin mainly designed for server administration. Besides this, AMXModX has a wide array of scripting capabilities so you write plugins which add on to a mod's functionality. Alternatively, you can choose plugins from a very large and varied database.
In this section, I'll explain how much Internet bandwidth and cpu/ram resources are needed to build an average server with 20 public slots (how much players can join your server) so these requirements can be slightly different if you decide to set-up a smaller or bigger server.
1,024kbps (128kB/s) download AND upload Internet speed with own Internet IP or LAN IP with forwarded ports
512MB RAM. It should work on 256MB but it's not recommended.
1GB disk space
Getting the files we need
First of all, we need to create a home directory for the dedicated server. Login as root and type this in the console:
# mkdir /usr/hlds
# cd /usr/hlds
Next, download the files:
# wget http://storefront.steampowered.com/download/hldsupdatetool.bin
# wget http://heanet.dl.sourceforge.net/sourceforge/metamod/metamod-1.19-linux.tar.gz
# wget http://heanet.dl.sourceforge.net/sourceforge/amxmodx/amxmodx-1.75a-base.tar.gz
# wget http://heanet.dl.sourceforge.net/sourceforge/amxmodx/amxmodx-1.75-cstrike.tar.gz
Presuming your current directory is /usr/hlds, you have to uncompress the hlds update tool:
# chmod +x hldsupdatetool.bin
If you get the sh: uncompress: command not found error, type this and then start over the last two commands:
# ln -s /usr/bin/gunzip /usr/bin/uncompress
After the uncompress action completed successfully, there should be a new file named 'steam'. Start the server installation typing the command:
# ./steam -command update -game cstrike -dir .
If the bootstrapper was updated, you have to run the command again. Depending on your connection speed, the install process could take from a few minutes to a few hours. The installation size is about 200MB. When the process is finished successfully, the following message will be printed:
HLDS installation up to date
The HLDS configuration is made through cvars. Cvars are variables that affect how your server is viewed and played. The HLDS cvars sit in a file called server.cfg. Here is an example of a server.cfg holding the minimum configuration cvars and here is the list of all cvars with descriptions.
Create the directories needed by MetaMOD typing these commands:
# mkdir /usr/hlds/cstrike/addons
# mkdir /usr/hlds/cstrike/addons/metamod
# mkdir /usr/hlds/cstrike/addons/metamod/dlls
Go to dlls directory:
# cd /usr/hlds/cstrike/addons/metamod/dlls
Extract the archive downloaded earlier:
# tar xfz /usr/hlds/metamod-1.19-linux.tar.gz
You should now have a file called metamod_i386.so in the dlls directory.
Next, you have to 'tell' the HLDS youre about to use metamod as your game dll. This is done by editing the file /usr/hlds/cstrike/liblist.gam using a text editor (of your choice). In that file you should see the line:
which you have to replace with:
Go to the cstrike directory and type the following commands:
# cd /usr/hlds/cstrike
# tar xfz /usr/hlds/amxmodx-1.75a-base.tar.gz
# tar xfz /usr/hlds/amxmodx-1.75-cstrike.tar.gz
You should now have a new directory named amxmodx inside the /usr/hlds/cstrike directory.
Next, you must tell MetaMOD you are going to use the AMXModX plugin:
# echo linux addons/amxmodx/dlls/amxmodx_mm_i386.so > /usr/hlds/cstrike/addons/metamod/plugins.ini
Minimal AMXModX Configuration
The AMXMODX configuration is pretty straightforward and it's made through the files inside the /usr/hlds/cstrike/addons/amxmodx/configs directory. Every file has its own cvars which are explained in detail so there shouldn't be any problems.
Creating users with access on your server
You can assign a username and a password to certain people which are going to administer your server. They are added in users.ini in the same configs directory. For example, if you add and admin with username Player and password 123, that admin has to type in his game console before connecting to your server:
setinfo _pw 123
The _pw string can be modified in amxx.cfg next to amx_password_field cvar. If, for example, you change the _pw string to _whatever, then the player has to type setinfo _whatever 123 before connecting to your server.
Add statistics and events
This is an optional step and you should do it if you want certain statistics and events being printed to every player's screen during the game. Among many others, the statistics show the most disruptive player and team for every round, how much damage one's made to the other, how much did he take and so on. This plugin is called StatsX and can be enabled editing modules.ini and plugins.ini:
Open it up with a text editor and uncomment (remove the; at the beginning of the line) the following line:
Open it up with a text editor and uncomment the following lines:
You can choose what events are enabled or not using the in-game stats config menu. For this, you have to add an account with maximum access to users.ini file, join the server with that account and type the following command in the game console:
The complete AMXModX commands and cvars list can be found on AMXModX official homepage, under the DOC section. The list is way too large to be added to this tutorial.
Starting the server
Change directory to /usr/hlds and type the command:
# cd /usr/hlds
# ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2
If you want to run the server in the background, you have two options:
# ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2 > /dev/null 2>&1 &
This will launch the server in the background, sending the output to /dev/null. The good thing about this variant is that you don't need any additional software installed. The bad thing is that you can't attach to it later and make live modifications to it. If you want to see what is happening while the server is running, replace /dev/null with the name of a file (eg. hlds.log) or use the next run option.
Presuming you already have screen installed and know a little about using it (detaching and re-attaching to it), start the server using the following command:
# cd /usr/hlds
# screen -A -m -d -S hlds ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2
To make the HLDS run at linux boot, just add the start-up command (with or without screen) to the /etc/rc.d/rc.local file. For example (using screen):
# echo cd /usr/hlds >> /etc/rc.d/rc.local
# echo screen -A -m -d -S hlds ./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_dust2 >> /etc/rc.d/rc.local
I hope you've found this guide helpful and have made an idea about how to create a Counter-Strike dedicated server with little effort. But this is just the beginning as there are many more things you can do and add to make your server an enjoyable gaming experience for you and those playing on it.
There are hundreds of addons and AMXModX scripts that customize and even radically change the gameplay on your server.