<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Create Steam Based HalfLife 1 or HalfLife2 Server in Linux

Published on
11,909 Points
5,709 Views
2 Endorsements
Last Modified:
Approved
Requirements:

root access via SSH, telnet, or other.. Alternately, access from the server administrator to run a counter-strike server, and the proper access rights to do so. Enough free disk space (and allowed to use this much, eg disk quota): 600MB (CS 1.6), 800MB (CZ), 1.2GB (CS).

A fast internet connection (at least fast ADSL or Cable).

A decent computer, mattering on how many users (IMO : minimum celeron 1.8ghz, 512 mb of ram)

Now,

Login as root
adduser cstrike
passwd cstrike (give it a pw)

su cstrike (become that user)

cd ~ (go to your home directory, or wherever you want to run HLDS aka Half-Life dedicated Server from)

Alternately, we can assume our home directory is: /home/cstrike/

So we would type: cd /home/cstrike/

Step 1:
http://www.steampowered.com (get Steam now)

current link for linux hlds:
http://storefront.steampowered.com/d...updatetool.bin

Inside console type: wget http://storefront.steampowered.com/d...updatetool.bin

once it is downloaded, type the following:
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin

*** You will now see the license agreement, review it carefully at your own risk ***

It will prompt for something like..

Do you agree: (type Yes)

Step 2:

./steam

** The current version of the steam client updates itself, if it just shows you a help menu, then read lower. **



Valid game types:

Half-Life 1
------------
"cstrike" - Counter-Strike 1.6
"dmc" - Death Match Classic
"dod" - Day of Defeat
"tfc" - Team Fortress Classic
"ricochet" - Ricochet
"valve" - Normal Half-Life 1 Deathmatch (use this also for a custom mod)

Half-Life 2
-----------
"hl2mp" - Half-Life 2 Multiplayer - use this for half-life 2 mods as well
"Counter-Strike Source" - self-explanatory, make sure you use quotes

./steam -command install -game "<game>" -dir hlds

This will take some time, so please be patient. It can take above 3 hours in some cases.. Enough free disk space is required on your hard drive: 600MB (CS 1.6), 800MB (CZ), 1.2GB (CS).

I suggest if you plan on running more than one that you keep the first installation, and simply make copies of it as you move along.

If you want to add a mod later:
./steam -command update -game "<game>" -dir hlds

This will also update HLDS and/or the game to the latest version, if it already exists.

(I put quotes around <game> just to make sure it works properly)

You can change -dir hlds to anything you want, including a specified install directory that does not already exist, eg /home/cstrike/hlds/ (it will create HLDS)

Step 3:

cd /path/to/hlds/<game>/

In our case, let us assume that HLDS is in /home/cstrike/hlds/, and we installed cstrike (Please note: Half-life 2 instructions are a little different. They are lower down.)

cd /home/cstrike/hlds/cstrike/

-- edit server.cfg, mapcycle.txt, and motd.txt --
Each box has a different editor, some ways you can do this are:


vi server.cfg
nano server.cfg
ee server.cfg
pico server.cfg

**Scroll to the end for a few guides on the text editors.
I suggest pico or nano, as they are the easiest to navigate. If it wants you to press ^X it means press CTRL-X.

Server.cfg is pretty self-explanatory. If you want a server that has no timelimit, where it says in server.cfg "mp_timelimit 20", change that to "mp_timelimit 0".

Do the same for mapcycle.txt (adjust the maps to be played on your server)

You can adjust motd.txt to whatever you want, even use HTML tags, or you could just leave it alone.

Half-Life 2
-----------
We are assuming you installed Counter-Strike Source.

Go to the url:
http://www.cstrike-planet.com/cfgmaker?cfg=srcds

Easiest way of making a server configuration file... Place it in the cstrike directory (eg /home/cstrike/hlds/cstrike/) in this case.

Step 4:

I will be using our example again, so..

cd /home/cstrike/hlds/ (directory for HLDS)

HL1
./hlds_run -game cstrike +maxplayers # +ip xxx.xxx.xxx.xxx +port 270xx +exec server.cfg &

HL2 (CSource)
./srcds_run -game cstrike +maxplayers # +ip xxx.xxx.xxx.xxx +port 270xx +exec server.cfg & 

Please note: Do not leave any values of # or x as they are.

ip is self-explanatory, if you do not understand, remove the line: +ip xxx.xxx.xxx.xxx

I also suggest that if you don't understand port to remove that line as well.

& puts the program in the background (eg after you log out the server will still run)..

It is also very useful to do the following thing:

nano/pico/ee/vi startserver.sh

Inside put the same line as you would have above, e.g.:

HL1
./hlds_run -game cstrike +maxplayers 16 +ip 192.168.1.10 +port 27021 +exec server.cfg &
HL2
./srcds_run +ip xxx.xxx.xxx.xxx +port 270xx +exec server.cfg &

Save and exit, then type: chmod +x startserver.sh

Now you can start your server by typing:

./startserver.sh
2
Comment
Author:Andy1988
0 Comments

Featured Post

Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Join & Write a Comment

In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month