Basic Linux Server Setup

 

Here you will find step-by-step information on how to download, install, set up, configure, and optimize your Linux box to become a great Counter-Strike server.  This how-to was designed to make it as easy and fast as possible to get your Linux box up and running with a dedicated Counter-Strike server.

I know that there are many flavors of Linux, so in order to keep things simple and make this tutorial applicable for all versions, we will configure and setup your Linux box exclusively from the command line interface (CLI).  The only notable exception to this will be for downloading the files for running your server.  To do so, you need to have an internet browser installed, configured and working, but after all, if you are reading this then you already have that set up!

For many CS server admins, Linux is the operating system of choice due to its stability and its speed compared to Windows based servers.  However, for most, because of operating system familiarity, Windows based CS servers may be easier to set up and tinker with, but Linux offers many advantages over the win32 server.  If you have decided, or are trying to decide if you want to use Linux to run your CS server, read on!

*NOTE:  After reading through this, don't forget to check the files / scripts page for some great scripts to help you run and maintain your Linux based CS server!

I will assume that you already have a *newer* version of Linux installed and configured correctly on your network.  If you need help with this, I suggest you use "linuxconf" to configure it and/or head on over to linux.org to get some help.  Here we go!

Log in to your Linux box, as "root" if you can - but be aware that you do not need to log in as root if you have another user account created that has the necessary access and privileges.  In fact, it is not recommended that you run your server as "root" at all due to inherent security risks.  There are many tutorials here that can help you create additional user accounts on your Linux server if you need help.

Once logged in, do not start x-windows, rather stay in the command line interface (hereafter referred to as the CLI).  If your Linux box automatically starts x-windows don't worry...  when it starts up, just click on the Terminal Emulation icon - you may have it on your taskbar or you may need to look in the "Start Menu" to find it.  When you do find it and click on it, a box should open up that has something similar to this:

[root@server /root]#

What you have may differ slightly depending upon who you logged in as and the name of your Linux box.  In this case, user "root" is logged into the Linux server named "server" which defaults to the directory "/root".

Now at your CLI, you want to type:

cd /

Now type this:

mkdir /halflife

Now type:

cd /halflife

If all is well, you should see this at the CLI:

[root@server /halflife]

Again, it may differ slightly depending upon who you logged in as and the server name, but you need to make sure you have the "/halflife" part in there.  If you don't see it there, go back and start again from the beginning - you did something wrong.

Now a quick side note that you do not have to use this directory ("/halflife"), and in most cases it would be better to use a directory such as "/usr/local/games/halflife" to install your Counter-Strike dedicated server into.  If you choose to use this directory instead (usually there is more disk space there) simply substitute

/usr/local/games/halflife

wherever you see

/halflife

And just start over at the top using this new directory.  Just remember to substitute your directory (/usr/local/games/halflife) wherever you see (/halflife) for the rest of this tutorial if you chose to go that route!

Now you have a new directory at the top level called "halflife".   This is where we are going to install your Counter-Strike server.  We need to download 2 files to get started.  You should be in the "/halflife" directory on your server, so when we download the files, they will be saved in this directory.  If you are not in the /halflife directory we created, or are not sure, simply type:

cd /halflife

You should now be in the correct directory.

Next, click here to download the latest full version of the Half-Life dedicated server for Linux.  The most current full version is called "hlds_l3103.tar.gz".  When that finishes downloading, type:

tar zxvf hlds_l3103.tar.gz

The computer will then proceed to unpack and install the dedicated server in the halflife directory we created earlier in a directory called "hlds_l".  When it finishes, type:

cd /hlds_l

You should now be in the directory "/halflife/hlds_l".  Now you need to download the Counter-Strike mod.  Click here to download the latest full version of the it for Linux dedicated servers.  The most current version is called "cs_beta7.tar.gz".

Once the file has downloaded, type this in the CLI you are at:

tar zxvf cs_beta7.tar.gz

This will unpack and install the Counter-Strike mod on your dedicated server.  When that finishes, you will need to type the following in your CLI:

export LD_LIBRARY_PATH=/halflife/hlds_l:$LD_LIBRARY_PATH

What this does is tells Linux to look in the "/halflife/hlds_l" directory for dynamic libraries.

You should now be able to run the basic Counter-Strike dedicated server.  Let's test it and see if it works.  Make sure you are in the "/hlaflife/hlds_l" directory and type the following in the CLI:

./hlds_run -game cstrike +maxplayers 10 +map cs_assault

The computer should then proceed to start a dedicated 10 player server with the cs_assault map.  At the end of starting the server you should see the following if all went okay:

WON Auth Server
   . . .

If you see the above, but are missing the "Auth" portion, there is most likely a problem with your server using the incorrect IP address.  A few things could be the cause of this.  First you need to see which IP address your Linux server is using for Counter-Strike.  Type the following:

status

It will give you something similar to this:

hostname:  Paco's Counter-Strike Server b7
version    :  3.1.0.0
build        :  1027
tcp/ip       :  63.226.81.153:27015
map         :  cs_assault at: 0 x, 0 y, 0 z
players     :  0 active (10 max) 

If your IP address is not what it should be (one you don't recognize), quit the server by typing this:

exit

Now let's try running it again with a new line, type:

./hlds_run -game cstrike +ip <your IP here> +maxplayers 10 +map cs_assault

For instance, if the IP address of my server were 63.226.81.153, I would type this:

./hlds_run -game cstrike +ip 63.226.81.153 +maxplayers 10 +map cs_assault

Now after you run that, let the game load and wait to see if it gives you "WON Auth Server" this time.  If it does, you re set!

If you still do not get the "WON Auth Server" it could be that you are behind a firewall.  If so, the only hope for you my friend is to speak to the network administrator and have him open the ports you need (27015 is the default).  In any case, he will be able to help you get it opened up to the internet.


Now that you have your server running, we need to optimize it.  You can run the server just as it is now - stock - but your clients won't get maximum performance from your server.  You need to edit your server.cfg file in your cstrike directory (/halflife/cstrike/server.cfg).  Look
here for some cvars (command variables) that you can add to this text file (server.cfg) to customize and improve your server.

If you get miscellaneous errors or are otherwise unable to get your server running, see the Linux Q&A section, browse the forums  and as a last resort, if you can't find the answer and you have a killer server sitting there dead-in-the-water, e-mail me.

For you Linux newbies, here is a really good resource link:
http://linux.com/howto/DOS-Win-to-Linux-HOWTO-4.html
 

 
Copyright © 2001 Counter-Server. All Rights Reserved. Site design by [TDTFFC]mouse.