How to setup Counter-Strike 1.6 Server on Linux
This tutorial is about setting up Counter Strike 1.6 Server on CentOS which is a flavor of Linux Operating System.
For setting up Counter Strike 1.6 Server on Windows, see this post Setup Counter-Strike 1.6 Server on Windows
Most people stay away from Linux because it is much more complicated as compared to Windows.
I myself prefer Linux Operating System because of its security and stability and that’s the reason I am writing this tutorial today.
Requirements
- CentOS
You can setup Counter-Strike 1.6 Server on your home computer or on a VPS (Virtual Private Server).
If you want to setup on VPS, read this post for hints on setting up VPS Setup TeamSpeak Server on Linux
If Linux is not your primary OS, you can install Linux on a VM (Virtual Machine).
Simply download and install VirtualBox and CentOS ISO files and your VM will be ready.
However in this tutorial I assume you already have CentOS Server ready with root privileges.
You can skip the next steps of requirements if you want to setup on VPS. - Internet Connection
For Online Server, an Internet Connection is required.
This tutorial is for home computers running on DSL Connection or WiMAX connection.
For 16 slots server, a 1Mb internet connection is sufficient.
For best performance, a 4Mb internet connection is preferred which can support upto 32 players. - Static IP
The Public IP address of DSL connections is Dynamic.
Which means on every restart of router the Public IP is changed.
To make the IP static you have to request your DSL provider to provide you a Static IP address.
PTCL users can get Static IP easily for a monthly charge of200300 rupees.
Call 1218 from your PTCL number to get a Static IP on your DSL connection. - UPS
To make your server 24/7 your computer must stay on all the times.
For that you will need a UPS that will provide backup in case of power outages.
Installation Steps
- Download PuTTY
If you are using Windows, you will need an SSH Client like PuTTY that lets you connect with your VPS.
Download PuTTY from here PuTTY.exe - Login to VPS
Once you have downloaded PuTTY, open it and you will see the screen below:
Enter your VPS IP address in Host Name field and press enter.
A black console window will open asking for the username.
Enter your username (which should be root) and press enter.
Now it will ask for your password like below:
Enter your password and press enter.
Note that your password will not be shown as you type it so don’t get confused.
Once you have logged in, you will see something like below:
- Server Installation
Write the following commands in PuTTY console one-by-one:
useradd -d /home/hlds -s /bin/false hlds
cd /home/hlds
wget http://cdn01.counterstrike.com.pk/web/files/hlds4linux_cspak.zip
unzip hlds4linux_cspak.zip
cd hlds4linux_cspak
chown -R hlds:hlds /home/hlds
chmod +x ./hlds_run
chmod +x ./hlds_i486
chmod +x ./hlds_i686
screen -A -m -d -S hlds su -c "./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000" hlds -s /bin/sh
After you have executed all the commands without getting any errors, the Counter Strike 1.6 Server should be started successfully in background. - Start Counter Strike 1.6 Server on Startup
Counter Strike 1.6 Server does not automatically starts when your VPS is restarted.
To start the server automatically on startup, execute the following commands:
echo cd /home/hlds >> /etc/rc.local
echo screen -A -m -d -S hlds su -c "./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000" hlds -s /bin/sh >> /etc/rc.local
Now the Counter Strike 1.6 server will automatically startup after crash or reboot. - Testing
This step is just to make sure that you have properly configured the server.
Open your game and click on Add Server.
Enter your Private IP with Port and click Add.
If you can see your server running, you can proceed to the next step. - Open Firewall
This step is not required if you are using VPS.
Now you have to open your Windows Firewall so that other people can connect to your server.
You need to open UDP port 27015 on your windows firewall.
Follow steps on this link to open Windows Firewall ports:
http://windows.microsoft.com/en-us/windows/open-port-windows-firewall
At this stage, you have created a LAN server which means people connected to your Router can now join your server. - Port Forwarding
This step is not required if you are setting up on VPS.
Now you have to “Forward the ports from your Router to your Computer” so that Online Players can connect to your server.
In simple words, all the people connecting to your Router on port 27015 will be forwarded to the port 27015 of your Computer.
There are hundreds of thousands of router models with different port forwading methods each.
Here are steps for some routers:
http://www.counterstrike.com.pk/2014/03/port-forwarding-on-dsl-modem-router/
For other routers, just google about it and you will find the steps. - Testing
This step is not required if you are using VPS.
This step is to make sure the firewall and ports are properly opened.
Goto this link and enter your server port to verify it is open Port Checker
To find your Public IP, visit this link : http://myip.counterstrike.com.pk/
Now you have created an Online Server which means people from all around the world can join your server.
Having problems? Just comment below and we will find you a solution!
For installing Counter Strike 1.6 Game on Windows based computer, visit this link: How to install Counter-Strike 1.6 Game on Windows
admin me esa kia karu k mera ip bar bar change na ho 1 ip per hamesha ho
You will need a Static IP.
Call your ISP and ask them to provide you a Static IP.
If you are using PTCL, call 1236 and ask them to assign you a Static IP.
PTCL charges 400 Rupees monthly for Static IP.
koi tariqa nahi hain k khood kare ip ko static?
Use this tutorial
http://lifehacker.com/124804/geek-to-live–how-to-assign-a-domain-name-to-your-home-web-server
gzip: stdin: not in gzip format
> tar: Child returned status 1
> tar: Error is not recoverable: exiting now
> [root@emohosting hlds]# cd hlds4linux_cspak
> -bash: cd: hlds4linux_cspak: No such file or directory
> [root@emohosting hlds]# cd hlds4linux_cspak
> -bash: cd: hlds4linux_cspak: No such file or directory
> [root@emohosting hlds]# chown -R hlds:hlds /home/hlds
> [root@emohosting hlds]# chmod +x ./hlds_run
> chmod: cannot access `./hlds_run’: No such file or directory
> [root@emohosting hlds]# chmod +x ./hlds_i486
> chmod: cannot access `./hlds_i486′: No such file or directory
> [root@emohosting hlds]# chmod +x ./hlds_i686
> chmod: cannot access `./hlds_i686′: No such file or directory
> [root@emohosting hlds]# screen -A -m -d -S hlds su -c “./hlds_run -game cstrike +ip 178.32.128.175 +port 27015 +maxplayers 32 +map de_dust2_long_short
> > cho cd /home/hlds >> /etc/rc.local
> > echo cd /home/hlds >> /etc/rc.local
> > echo screen -A -m -d -S hlds su -c “./hlds_run -game cstrike +ip 178.32.128.175 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000” hlds -s /bin/sh >> /etc/rc.local
bro yeh dekho kya karun ??
Sorry there was a mistake in the above commands.
Replace these lines:
wget http://cdn01.counterstrike.com.pk/web/files/hlds4linux_cspak.tar.gz
tar -zxvf hlds4linux_cspak.tar.gz
With these lines:
wget http://cdn01.counterstrike.com.pk/web/files/hlds4linux_cspak.zip
unzip hlds4linux_cspak.zip
Now it should be working fine.
I have updated the post with the fixed commands.
Thanks a lot for reporting that error 🙂
Ip10.94.130.103:27015
How to configure the server after setting it up ??
You can use WinSCP to edit configuration files or you can use “vi” command from PuTTY!
Hi I have just followed your guide everything was smooth but I cannot connect to the server. I have my dedicated VPS in europe and I cannot connect to server Please help!
Connected Sorted the issue. Can you Please tell me how to remove the banner that appear in the game 🙂
the banners that appear in game sohaibnova.blogspot.com I want to edit them Please help!!
In case you still are unable to remove those banners, edit your cstrike/server.cfg and cstrike/addons/amxmodx/configs/amxx.cfg files to remove the banner related commands.
Let me know if you still have issues with it.
bhai mere pas yahi issue araha hie ap nei kesay solve kia?
Sab kuch sahi hie running hie but CS 1.6 mein add kar raha ho tou show nahi horaha waha kindly help in this.
Salam Taimoor bhai I want to add counter strike source as well as condition zero in my server is it possible if yes my messages awaits your guidance.
Ws.
No brother that is not possible.
There are separate server setups for each flavor of Counter-Strike.
You cannot run Counter-Strike 1.6, Counter-Strike Source, Counter-Strike Global Offensive on the same server.
However, you can run multiple servers on the same machine with different Counter-Strike flavors on different ports.
Good luck!
i got this error its say this.
unzip hlds4linux_cspak.zip
-bash: unzip: command not found
That means zip program is not install on your system.
Write the following commands to install zip and try again:
yum -y install zip
yum -y install unzip
Dude, everything is running but apparently its not listening on any proto tcp/udp
# ps aux|grep hlds
root 1311 0.0 0.0 118488 1200 ? Ss 09:22 0:00 SCREEN -A -m -d -S hlds su -c ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000 hlds -s /bin/sh
root 1312 0.0 0.0 145000 1580 pts/1 Ss+ 09:22 0:00 su -c ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000 hlds -s /bin/sh
hlds 1313 0.0 0.0 106200 1500 ? Ss 09:22 0:00 /bin/sh ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000
# netstat -pan|head
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1144/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1223/master
tcp 0 80 66.XX.XX.16:22 39.XX.133.XX:53219 ESTABLISHED 1267/sshd
tcp 0 0 :::22 :::* LISTEN 1144/sshd
Active UNIX domain sockets (servers and established)
The “head” command doesn’t displays the full output.
Use this command instead:
netstat -pan | grep 27015
It will show something like this:
udp 1793 0 0.0.0.0:27015 0.0.0.0:* 1101/./hlds_i686
Let me know if it still doesn’t show up in there!
Listener not working
[root@ip-172-31-42-141 hlds4linux_cspak]# netstat -pan | grep 27015
[root@ip-172-31-42-141 hlds4linux_cspak]# ps aux|grep hlds
root 304 0.0 0.3 192524 3992 ? Ss 23:01 0:00 su -c ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000 hlds -s /bin/sh
hlds 305 0.0 0.2 119984 2912 ? Ss 23:01 0:00 /bin/sh ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000
root 618 0.0 0.2 134476 2776 ? Ss 23:06 0:00 SCREEN -A -m -d -S hlds su -c ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000 hlds -s /bin/sh
root 619 0.0 0.3 192524 3932 pts/7 Ss+ 23:06 0:00 su -c ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000 hlds -s /bin/sh
hlds 620 0.0 0.2 119984 2904 ? Ss 23:06 0:00 /bin/sh ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000
hlds 634 0.0 0.0 114656 764 ? S 23:06 0:00 cat
hlds 868 0.0 0.0 114636 740 ? S 23:09 0:00 sleep 10
hlds 875 0.0 0.0 114636 800 ? S 23:09 0:00 sleep 10
root 878 0.0 0.0 119420 944 pts/4 S+ 23:09 0:00 grep –color=auto hlds
root 32651 0.0 0.3 192524 4000 ? Ss 22:53 0:00 su -c ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000 hlds -s /bin/sh
hlds 32652 0.0 0.2 119984 2992 ? Ss 22:53 0:00 /bin/sh ./hlds_run -game cstrike +ip 0.0.0.0 +port 27015 +maxplayers 32 +map de_dust2_long_short +sys_ticrate 1000
# telnet 54.236.45.48 27015
Trying 54.236.45.48…
telnet: connect to address 54.236.45.48: Connection refused
on netstat -pan | grep LISTEN
unix 2 [ ACC ] STREAM LISTENING 60495 1040/SCREEN /var/run/screen/S-root/1040.hlds
Can Anyone Tell Me How To Install OGP ON Linux Vps And MAke CS Server From OGP Can ANyone Tell Me With Full Tutorials
Please
Follow instructions on this page as per your Linux flavor: https://sourceforge.net/p/hldstart/wiki/Installation%20Notes/
Don’t hesitate to ask if you get stuck somewhere 🙂
Server Is Running GG Good Work
But One Problem When I Change Map Of Server …. Server Crashed
Sorry RIP Rnglish ..
In Roman Urdu,
Server bilkul theek chalraha hai awesome good work but ek problem hai jab mein server ka map change krta ho to server crashed hojaata hai why? any solution pls
the Hlds you have given in tut gets well install and also the server runs but i am fasing that i have tried every thing but this server is not going to VAC protected I also set the secure ‘1’ in liblism.gam whatever its name and i also added this in run command -secure the server still not VAC protected please Help
bhai mere pas yahi issue araha hie ap nei kesay solve kia?
Sab kuch sahi hie running hie but CS 1.6 mein add kar raha ho tou show nahi horaha waha kindly help in this.
Okay sorted connection problem. Let me share here. Port 27015 was block from firewall so need to edit the firewall and add the accept udp port 27015 then it will work.
I have been able to setup the server but the match is created with maxplayer 6 instead of 32
anyway. It was a typo. What I still can figure out is how to make Steam official client download the maps from the server automatically. The non-steam clients downloads them fine, but the official don’t.
This article is the most informative, useful, and simple.
Many thanks to the author.
Only one thing to add: hlds should start from non-root user and beetter way to start the server is
screen -dmS hldsserv ./hlds_run -game cstrike + +port +maxplayers 32 +map de_dust2 +sys_ticrate 1000
Hello
first of all I would like to thank you for the tutorial and all the help you share with the community, if not I wonder if you have an update file of the cs pack for linux server with the 47/48 protocol since the one this is at least 5 years old
thanks in advance