Create Steam Based HalfLife 1 or HalfLife2 Server in Linux

AID: 1930
  • Status: Published

2580 points

  • ByAndy1988
  • TypeTutorial
  • Posted on2009-11-10 at 06:21:25
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
Asked On
2009-11-10 at 06:21:25ID1930
Tags

create server

,

halflife

Topic

Computer Servers

Views
1936

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Server Hardware Experts

  1. andyalder

    343,946

    Wizard

    6,464 points yesterday

    Profile
    Rank: Genius
  2. hanccocka

    169,853

    Guru

    1,800 points yesterday

    Profile
    Rank: Genius
  3. dlethe

    134,276

    Master

    750 points yesterday

    Profile
    Rank: Genius
  4. Callandor

    66,040

    Master

    0 points yesterday

    Profile
    Rank: Genius
  5. PowerEdgeTech

    51,546

    Master

    0 points yesterday

    Profile
    Rank: Genius
  6. charlestasse

    49,038

    0 points yesterday

    Profile
    Rank: Wizard
  7. arnold

    37,415

    0 points yesterday

    Profile
    Rank: Genius
  8. kevinhsieh

    34,882

    0 points yesterday

    Profile
    Rank: Genius
  9. noxcho

    31,714

    668 points yesterday

    Profile
    Rank: Genius
  10. paulsolov

    26,304

    0 points yesterday

    Profile
    Rank: Genius
  11. leew

    22,982

    560 points yesterday

    Profile
    Rank: Savant
  12. rindi

    22,689

    0 points yesterday

    Profile
    Rank: Savant
  13. BigSchmuh

    22,258

    0 points yesterday

    Profile
    Rank: Sage
  14. meyersd

    20,732

    0 points yesterday

    Profile
    Rank: Genius
  15. demazter

    20,140

    0 points yesterday

    Profile
    Rank: Genius
  16. pgm554

    18,510

    0 points yesterday

    Profile
    Rank: Sage
  17. IT-Monkey-Dave

    18,418

    0 points yesterday

    Profile
    Rank: Wizard
  18. coolsport00

    18,036

    1,400 points yesterday

    Profile
    Rank: Genius
  19. jamietoner

    16,216

    0 points yesterday

    Profile
    Rank: Genius
  20. SelfGovern

    15,028

    0 points yesterday

    Profile
    Rank: Wizard
  21. woolmilkporc

    14,532

    0 points yesterday

    Profile
    Rank: Genius
  22. dariusg

    14,160

    0 points yesterday

    Profile
    Rank: Genius
  23. Syed_M_Usman

    12,008

    0 points yesterday

    Profile
    Rank: Wizard
  24. chakko

    11,940

    0 points yesterday

    Profile
    Rank: Genius
  25. cwstad2

    11,832

    0 points yesterday

    Profile
    Rank: Guru

Hall Of Fame