Installing hldStart2 on Linux


Rev. 02.02.2008

Prerequisets:
- Webserver (tested on Apache2 and lighttpd)
- PHP with DBA support (Like Berkely DB and GNU DBM)

- PHP with xml-rpc
- DBA refers to flatfile databases, not RDBMS, like MySQL or Postgres SQL.
- No Database server is required

If your PHP doesn't have DBA support (the setup utility in Step 4 will tell you) you need to fix that.
On Gentoo add berkdb or gdbm to your use flags and re-emerge php.
For package based distros, look for php-dba in your package manager


Based on my testing

OpenSuSE 10.3 will need: php5-xmlrpc, php5-dbm, php5-posix, and perl-XML-Parser

CentOS5 will need: php-xmlrpc, php-dba, and perl-XML-Parser

Fedora6 will need php-xmlrpc, php-dba, and perl-XML-Parser

Gentooadd berkdb and xmlrpc to USE, and re-emerge php. Also emerge dev-perl/frontier-rpc

Ubuntu 7.10 Serverlibxml-parser-perl, php5-xmlrpc


Ubuntu 7.10 known issue: There is a bug with either the Berkeley DB libraries, or the php-dba api. Anytime I accessed an hldStart page that would try to read a db file, the page would be blank, and a Segfault error would show up in the Apache error log.

Ubuntu 7.10 works fine with the hldStart agent
If anyone could shed some light on this issue, that would be awesome.

New Architechure – Read this first -

hldStart 2 v-2.2008 had a major change. I have mentioned that this release would have a remote agent, that will allow you to control multiple game servers from a single hldStart web page.

The remote agent is now available in this version, but it is also required.

It was taking a lot of extra coding to handle activities local to the webserver, as well as remote agent. So now, everything is done with the remote agent, even if your are running your games on the same server as the web server.

Don't worry, it's not a pain to setup. Plus, you no longer have to fiddle with permissions in order to get the web server's user to start games.

Game files can now be owned by their user (local Unix ID). Who ever is the owner of the game server executable is who it will run as. The agent handles this automatically.

Also, the use of an agent introduces many possibilities, like the ability to automatically restart game servers when the box is rebooted, OS monitoring/reporting, and automatic updates.

With that said, continue with your setup!

Installing the hldStart2 remote agent

 Download and unpack the files

tar -C /path/to/webdir -xzvf hldstart2-vXY.tar.gz

Included with the hldStart2 web package, is the remote agent and it's install script.

Look inside the root of your hldstart2 directory, and look for an hldstart_agent directory.

In there you'll see install.sh, and hldstart_agent.tar.gz.

(To install the agent on other servers, simply copy install.sh and hldstart_agent.tar.gz to the desired server(s))

Simply run install.sh as root - ./install.sh

The install script will do the following:

Create /opt/hldstart directory

Copy the agent's files there

Copy an init script to /etc/init.d/hldstart_agent

Install the Tea-Crypt perl module

It will ask you 3 questions, only 1 of which you are required to answer:


Set encryption key:abc12345 <-- You must set this, and it has to match the key you put in the setup webpage

Set the listen port

Nobody should need to change this...but here is the option if you need to

Set listen port:[Default 12679]

Set the listen IP

Default is bind on all interfaces...changing is also optional

Set listen IP:[Default 0.0.0.0 (all interfaces)]


It will then write out your config file.


To make sure everything is ok, cd to /opt/hldstart and run “./hldstart_agent.pl”

It should startup and take control of the terminal. You should see no output.

If everything looks good – hit <Ctrl – C> to exit out.

Now start it normallly - /etc/init.d/hldstart_agent start


If you want the agent to start when the machine boots up, add it to your startup using your distro's native init control

Redhat, Fedora, CentOS and SuSE: chkconfig hldstart_agent on

Gentoo: rc-update add hldstart_agent default

Ubuntu: ??? - Anyone know? Is it manual symlinks?


Do I really need to install this agent?

Short answer: Yes

Long answer: You need to install the agent anywhere you run a game server, including the webserver hosting your hldStart2 pages.

If your webserver that hosts your hldStart2 pages doesn't run any game servers, you don't have to install it there. However, future versions of the agent will probably have features that will be useful on non-game server boxes, like an hldStart updater, or a game server monitor to gather machine stats.

Upgrading hldStart2 web

If you are currently using hldstart2-v62007, upgrading is very easy.  

1. Move your 62007 version directory.
    mv /path/to/hldstart2  /path/to/hldstart2.bak

2. Back up your data diretory
    cp -a /path/to/datadir /path/to/datadir.bak

3.  Untar the new version into your web directory   
   tar -C /path/to/webdir -xzvf hldstart2-vXY.tar.gz

4.  Setup your config file
      cd /path/to/webdir/hldstart2-vXY
      touch config.php && chmod a+w config.php

5.  Run the setup utility in a web browser
        http://server/hldstart2-vXY/setup/setup.php

6.  Enter all of the required data
        Enter your existing datadir in the data directory field.
        ****WARNING****  You must select the SAME db type.  
     For example:  If you used Berkeley DB4 previously, you must use it again.  It's ok if the minor versions are different (like 4.4 vs 4.5)

7. Login to your new hldStart2 installation

8. Some of the DB formats have changed, but the update is seamless.  
        Simply (as an admin) go to User List > Edit any user (with configured games) > Edit any of the User's games >
        You should see some output when this page loads about fixing the DB.  It shows up after the User's list of allowed IPs.  It only does this once,             then you're done.  
        Output example:   Fixed key to 192.168.1.105:27016 and value to xgregx:hl1

You're done!  Continue to use your hldStart2!

Installing hldStart2 web (new install)


1. Create your data directory (hldstart stores it's data/db files here)

mkdir /path/to/datadir
(Data dir should be outside your web directory. Your home directory is a good place. Some web server configurations don't allow scripts to go outside the public html dirs. If this is your case, you can put the data dir in with your hldstart pages)

Change ownership of the datadir to the webserver's user
chown <webserver user> /path/to/datadir
(The webserver needs to write here)

2. Create empty config.php in hldstart directory

touch config.php && chmod 777 config.php

3. Run setup utility

    http://yourserver/hldstart2/setup/setup.php
    The utility will check a few things. If it finds a problem it will tell you what to correct.
    Fix the problem, refresh the page and try again

    Things you need to fill in:
    Data Directory: Enter the path to the directory you created in Step 2
    Logging: Enable or disable logging in hldstart. Log is written in your data directory. (Enabled is recommended)
    Remote Agent Key: Communication between hldStart and the agent uses a simple encryption scheme.
    Enter any alpha-numeric (like abc12345) encrytption key you want. It must match in both your web config, and the agent's config
    Remote Agent Port: You don't need to change this, but you can if you need to
    DB types: The DB handlers available on your system
    hldstart2 was tested with Berkely DB4. That's what I recommend
    If none are in the list, see the requirement list on how to fix this

4. Write your config file

When you are happy with your values, hit "Write Config"
Your config.php will be built, and the admin user will be added

5. Remove write access from the config.php file

chmod a-w config.php

6. Login to hldstart2

    http://yourserver/hldstart2
    Default user:admin Default Password: admin


Initial Configuration

Log in and go to “Servers & Ips” first




























If you are going to run games on the web server that serves your hldstart2 pages, add localhost to the Remote Host list.




























Next, you have to add at least 1 IP address for games to bind on. For localhost, don't use 127.0.0.1, use the real IP address.
You can add as many as 4 IPs, but most people will only need 1.
Next add additional remote hosts if you have them:



























Next we want to add a new user
Go to the “User List” link
Enter a username and password and hit “Add User”
In this example I added “greg”




























Next, Click “[Edit]” next to your user's name

































Set your user's options. Fullname, email, and password can be changed by the user when he is logged in.

An admin has to set if the user is an admin or not, steam settings, when the account expires.

If the account never expires, set month's to “X”

Next we'll add and configure the user's games

Pick a game type from the drop down box and enter the path to the game's directory.
New in this version, you must enter the server where the game resides, followed by the path. It's like an NFS mount format. Servername:/path/to/gamedir

Click “Add Game”
































Click the “[Edit]” link next to your Game path

Set the ports this user will be allowed to use for the given game type (HL1 in this example)































Next add the game types assigned to this user by selecting them from the drop menu.

Click “Add Game”
Once the game is added, you can set the max number of players.































Contratulations, you just setup a user to run Counter-Strike on a remote server named “centos5”.

Follow this procedure for adding other games.