CS 1.6 on a Linux install

Post Reply
User avatar
Edge100x
Founder
Founder
Posts: 12945
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

CS 1.6 on a Linux install

Post by Edge100x »

Linux can be a bit more complicated to use than Windows, and generally HL1 server performance is better on Windows, so we recommend against using Linux unless you are already familiar with the OS and prefer it for other reasons than running game servers. That said, here's how to get going, from scratch, using our Gentoo Linux (+ common games installs) package.

1. Log in to your VDS through SSH. You can do this by loading up Putty, then connecting to your server using the information given on the "Server control" page in your control panel.

2. Change to the correct directory for CS 1.6.

Code: Select all

cd /usr/steam/hldsbase
3. Gentoo users can skip this step. On CentOS, install the "screen" utility with this command:

Code: Select all

yum install screen
4. Start up your server inside a "screen" session with a command like this:

Code: Select all

screen -AmdS screenname chrt -r 20 ./hlds_run -game cstrike +ip xxx.xxx.xxx.xxx +maxplayers xx -pingboost 2
Where "screenname" is an identifier you want to use for the screen (so that you can reconnect to it later), and the "x"s represent the actual IP and maxplayers that you wish to use.

If you're running Condition Zero, just put "czero" instead of "cstrike". For DoD, use "dod".

5. Your server will now be running in the background (inside what's called a "pseudo terminal"), and will continue running, even after you close your SSH window. To view it in the foreground, type this:

Code: Select all

screen -r screenname
Where "screenname" is the same one that you used when you started the server.

To hide the screen session again, hold down the control key and hit "a"; then, let go of both keys and hit "d". You should see the message "[detached]" and be returned to the normal command prompt.

6. To make the server start up when the machine is started, edit /etc/conf.d/local.start (Gentoo) or /etc/rc.local (CentOS) and add the same lines you used above. You can easily edit it with this command:

Code: Select all

nano /etc/conf.d/local.start
or:

Code: Select all

nano /etc/rc.local
And add the lines:

Code: Select all

cd /usr/steam/hldsbase
screen -AmdS screenname chrt -r 20 ./hlds_run -game cstrike +ip xxx.xxx.xxx.xxx +maxplayers xx -pingboost 2
To exit out of the text editor, use "Control-X" and enter "Y" when it asks if you want to save the file.

The easiest way to run multiple servers is to copy the "hldsbase" folder to a second one:

Code: Select all

cd /usr/steam
cp -rp hldsbase hldsbase2
Then, simply follow the instructions given above, adapted for the different folder and other IP address.

A few other useful "screen" commands to get you going:

Code: Select all

screen -ls
Shows a list of running (and detached) screens.

Code: Select all

screen -DR screenname
Detach a screen remotely and then reattach it to your session (if you left it attached in a window on a different machine, or your SSH connection was interrupted, this can be very useful to recover it).

Code: Select all

screen -wipe
If you rebooted your machine and the old screen shows in "screen -ls" as "dead", you can use this to remove it from the list.

Control-a, Escape will let you cursor through the screen buffer while you are attached to a screen. Hitting Escape again will get you back out.
Post Reply