HomeDownloadsHelpForums HLstats

HLstats Installation

Dependencies

HLstats requires:

You should install all of the above software before attempting to install HLstats. These instructions are for Linux (or any Unix supporting all of the above dependencies). Separate instructions are provided for installation under Windows.

Installation Instructions

  1. Extract the distribution tarball.

    shell> tar xzvf hlstats-version.tar.gz


  2. Create the MySQL database:

    shell> mysqladmin create hlstats


    (Where "hlstats" is the database name, which must match the settings DBName in hlstats.conf and DB_NAME in hlstats.php, which you will configure in a moment.)

  3. Create required tables:

    shell> mysql hlstats < hlstats.sql


  4. Import default settings for the games you want to run statistics for. Default settings for several games are provided in separate gamesupport_game.sql files. Import all of the games you want as follows:

    shell> mysql hlstats < gamesupport_game.sql


    For example, if you want to run statistics for Counter-Strike, do:

    shell> mysql hlstats < gamesupport_cstrike.sql


    If support for the game you want to run statistics for is not provided, check for additional gamesupport files at https://hlstats.org/downloads.php. (Note that, to be compatible with HLstats, games must support the Half-Life Standard Log Format.)

  5. Optional: Create a MySQL username and password for HLstats.

    shell> mysql --user=root mysql
    mysql> GRANT ALL ON hlstats.* TO hlstats IDENTIFIED BY 'somepassword';


    The first "hlstats" is the database name, the second is the username to create.

    Note Depending on your MySQL server configuration you may need to do "TO hlstats@localhost" instead of just "TO hlstats".

  6. Edit hlstats.conf.

    • Configure the database options to suit your MySQL server details.
    • Follow the comments to make any other desired changes.

  7. Edit hlstats.php.

    • Configure the database options to suit your MySQL server details.
    • Configure the INCLUDE_PATH setting to match the location where you will put the hlstatsinc directory.
    • Follow the comments to make any other desired changes.

  8. Copy hlstats.php and the hlstatsimg directory to a Web-accessible location. All other files and directories should be kept in a NON-Web-accessible location (examples below will assume /usr/local/hlstats).

  9. Configure user, game and server settings. Go to the following URL:

    http://your-server/path/hlstats.php?mode=admin
    Log in as user admin with password 123456.

    The admin interface is broken up into various sections: General Settings, Game Settings and Tools. Under each section are groups of settings, which when selected are represented as a table. You can enter information in the fields in the rows and columns to change existing values, and enter values in the blank row at the bottom to create a new row.

    • IMPORTANT: First you should create your own username and password from the Admin Users page, and delete the default admin/123456 user!
    • IMPORTANT: For each game, select the game's name and then select Servers. Configure the server addresses that you want to collect data from. HLstats will ignore any data coming from servers that it does not recognise!

  10. Run hlstats.pl. It will by default run in the foreground (like HLDS) - to make it run in the background use something like:

    shell> nohup ./hlstats.pl &


    It does not need to be run as root; running in an unprivileged user account is recommended.

    Most shells will let you run a program in a loop, so that if it dies/crashes it will be automatically restarted. For example, you might want to try:

    shell> while true; do nohup ./hlstats.pl; sleep 5; done &


    (Bourne Again Shell syntax.)

  11. Configure your game server(s) to log data remotely using logaddress. Recommended method:

    • Create an autoexec.cfg file in the mod's directory (e.g. cstrike\autoexec.cfg), if it does not already exist. HLDS will automatically execute this file once at startup. (Note DO NOT place logging commands in your server.cfg!)

    • Place the following lines in the file:

      log on
      logaddress 1.2.3.4 27500

      map de_dust


      Where 1.2.3.4 is the address of the machine running hlstats.pl. 27500 is the default HLstats port, it must match Port in hlstats.conf, which can be anything.

    • Start up the game server.

  12. If you want daily awards, configure a cron job to run hlstats-awards.pl once a day. For example:

    shell> crontab -e


    And add a line to your crontab like:

    30 00 * * *     cd /usr/local/hlstats; ./hlstats-awards.pl


    This will generate the awards at half-past midnight every night. For more information see crontab(5).

    Note that hlstats-awards.pl looks at the previous day's data, so you won't get any awards until you have been running HLstats for about a day.

    (For performance reasons awards are not generated in real-time.)

  13. View your HLstats real-time player and clan rankings and statistics online at:

    http://your-server/path/hlstats.php
Enjoy!

Further documentation and resources can be found at https://hlstats.org/help.php.

Copyright © 2000-2004 Simon Garner.