Softpedia
 

NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
TRENDING TODAY
Home > News > Linux > Other Tips, Tricks and Tutorials

September 15th, 2006, 07:50 GMT · By Mihai Marinof

How to Set-Up a Counter-Strike 1.6 Dedicated Server under Linux

SHARE:

Adjust text size:

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.

Hardware Requirements

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.

Requirements:
1,024kbps (128kB/s) download AND upload Internet speed with own Internet IP or LAN IP with forwarded ports
1GHz CPU
512MB RAM. It should work on 256MB but it's not recommended.
1GB disk space
libstdc++.so.5 library


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


Installing HLDS

Presuming your current directory is /usr/hlds, you have to uncompress the hlds update tool:

# chmod +x hldsupdatetool.bin
# ./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


Configuring HLDS

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.


MetaMOD Installation

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:

gamedll_linux "dlls/cs_i386.so"

which you have to replace with:

gamedll_linux "addons/metamod/dlls/metamod_i386.so"

AmxMODX Installation

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:

name Player
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:

modules.ini
Open it up with a text editor and uncomment (remove the; at the beginning of the line) the following line:

csx_amxx_i386.so

plugins.ini
Open it up with a text editor and uncomment the following lines:

statsx.amxx
miscstats.amxx
stats_logging.amxx

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:

amx_statscfgmenu

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:

Normal
# ./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.

Using screen
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.

Have fun!


162,323 hits · 26 comments
Link to this article · Print article · Send to friend

MUST-READ RELATED ARTICLES:


Debian Installation Guide

Installing A Linux Distro to An USB Drive

Flash Player for Linux

Configuring the Ethernet Interface from The Command Line

How-to Use Your Partitions in Linux

READER COMMENTS:


Comment #1 by: salman on 14 Dec 2007, 09:59 UTC reply to this comment

i want to create a counter strike 1.6 server for online playing with the world and i want the cs_assault to be my map and i'de like being the admin on that server

My regards

Comment #1.1 by: Amir on 05 Nov 2012, 01:08 GMT

You can get a vps from a hosting provider like vpsland.com, constant, readymakers.com , etc. and ask them to install CentOS for you.
Once you have CentOS, you can follow the guidelines here and you will be ok!


Comment #2 by: khalid on 16 Feb 2008, 18:47 UTC reply to this comment

i want to add player wen i want to play alon with my computer

can you tell me how ??


Comment #3 by: creator on 20 Mar 2008, 11:52 UTC reply to this comment

Why when I try connect ! I'm see the error? :Invalid CD key.


Comment #4 by: Erodit on 14 Apr 2008, 14:14 UTC reply to this comment

I Love Conter Strike


Comment #5 by: NeWbiE on 08 May 2008, 10:37 UTC reply to this comment

This is non steam or steam ?


Comment #6 by: tom on 14 Feb 2009, 21:03 UTC reply to this comment

thanks for the guide... i used parts of it because i didn't know linux commands, although not all of it was useful, theres several other linux guides but thanks for your effort, every bit of information is useful


Comment #7 by: Brk on 03 Mar 2009, 13:48 UTC reply to this comment

Well i downloaded the hldsupdatetoo.bin, gave it the proper rights and started it, but when i type yes in the license agreement the probram stops :
Enter 'yes' to accept this agreement, 'no' t decline : yes
root#0[hlds]:

Any ideas how to solve this one ?


Comment #8 by: DinoFly on 15 Mar 2009, 08:40 UTC reply to this comment

Brk you probably didnt make symbolic link of gunzip with uncompres. Use the command:
# ln -s /usr/bin/gunzip /usr/bin/uncompress

and then try again. This should do the job. And make sure you have libstdc++.so.5 library instaled on your system. To check this try this command on Fedora system

rpm -qa | grep libstdc

and

rpm -qa | grep compat-libstdc

and if it is not found on your system than install it with

yum install libstdc*

and

yum install compat-libstdc*

hope this works


Comment #9 by: neBu on 18 May 2009, 23:17 UTC reply to this comment

I did all the above still works perfectly, but I want to make the server nosteam how they do that? can you help me? , thanks


Comment #10 by: Chesas on 19 May 2009, 13:41 UTC reply to this comment

If you want your server to be non steamed, you have to install cbooster in it...


Comment #11 by: neBu on 27 May 2009, 00:54 UTC reply to this comment

Ok, i have installed cbooster , server now is running no steam but , da admin mod is not work ? you can't help me?
thanks

Comment #11.1 by: Chesas on 28 Nov 2009, 09:15 GMT

I suggest You not to install mods seperately but install admin mod with booster, cbooster or dproto, hlguard 2.8, metamod and amxmodx....

Comment #11.2 by: moklesdridi on 05 Nov 2010, 16:17 GMT

i can play with you any time


Comment #12 by: naf on 24 Aug 2010, 12:06 UTC reply to this comment

this great, thanks, you should update this because there is newer versions


Comment #13 by: Bazil on 06 Mar 2011, 12:16 UTC reply to this comment

I have this problem when I try to update steam:
Getting version 42 of Steam HLDS Update Tool
Illegal instruction (core dumped)

What can I do?
thanks

Comment #13.1 by: jackuzzy on 14 Oct 2011, 20:40 GMT

i have installed cstrike server in Ubuntu 10.04 successfully. nothing needed more than update.


Comment #14 by: DJ Teizer on 27 Apr 2011, 16:49 UTC reply to this comment

why then i wrote in terminal mkdir /usr/hlds he denied o then i wrote cd /usr/hlds he say what no such directory why?????((((

Comment #14.1 by: jooiiee on 28 May 2011, 16:55 GMT

you will need to put sudo before mkdir. But use sudo with extreme caution, if you dont know wat you are doing you can * things upp bigtime.


Comment #15 by: gent0s on 22 Aug 2011, 13:39 UTC reply to this comment

What command I need to close the server again?


Comment #16 by: :D on 13 Sep 2011, 22:33 UTC reply to this comment

mwhahahaha nice job


Comment #17 by: Arash on 06 Feb 2012, 12:54 UTC reply to this comment

How can i do it for no steam ? cant find how to install cbooster


Comment #18 by: nonick on 02 Apr 2012, 10:26 UTC reply to this comment

Segmentation fault ????

Comment #18.1 by: aka Pipo on 02 Apr 2012, 15:23 GMT

Yes dude, i faced this error too. Any ideas?


Comment #19 by: aka Pipo on 02 Apr 2012, 15:22 UTC reply to this comment

After starting the server next error appears:

Executing AMX Mod X Configuration File
Scrolling message displaying frequency: 10:00 minutes
success = yes
response: CrashID=bp-30f040a1-15f7-41f1-92b7-fc1b72120402

Segmentation fault


Comment #20 by: counter strike on 21 Apr 2012, 11:45 UTC reply to this comment

this sites are really useful in terms of informations we could gain and apply to our computers. game lovers, here comes counter strike. the best game ever known.

Copyright © 2001-2013 Softpedia. Contact/Tip us at

WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM