This page describes the installation process of HLStats. Here are only those details which are needed to setup and make a first run. For more information have a look at the other pages listed in the menu on the left. ########################## ## Requirement ########################## See the requirements.txt file ########################## ## Unpack and file location ########################## After download you should have the latest stable version or your Hard disk. Now unpack/extract it into a temporary folder to get an idea if the folder structure. It should look like this: daemon/ docs/ install/ tools/ upgrade/ web/ ChangeLog LICENSE Here is the explanation what this is all about: daemon/ The hlstats.pl daemon which collects the data from the game server and all necessary files and the configuration file (hlstats.conf) are stored here. Keep this folder in a not web accessable place, or if you have to, protect it with a htaccess file. docs/ Well there are the documentation files. install/ There are the required files to install HLStats. tools/ Little scripts which will help you running HLStats. ( I will go in detail later ) upgrade/ If you are upgrading from a previous version you have to look into this folder and read the documentation here. web/ Those files are going be on the webserver. This is where you can show and manage your HLStats. It's nothing special here, you can copy without any doubt the whole contents onto your webserver. ChangeLog In this file you can see all the changes made for each version. It also sometimes inlcude important information. So try to read it sometimes. LICENSE The GPL License v2 All files in the webroot folder Here are a examples on how to place the files in your file system: All in one place eg. webspace ( / is your webroot path ) /hlstats/ /hlstats/daemon/ # secure this via a .htaccess file /hlstats/class /hlstats/css /hlstats/hlstatsimg /hlstats/hlstatsinc /hlstats/lang /hlstats/signatures /hlstats/tmp /hlstats/hlstats.php /hlstats/sig.php /hlstats/xml.php As you can see we've upladed only the daemon folder and the contents of the web/ folder. Nothing more is needed if you run it this way. Seperate folders for deamon and web files (recomended way) /home/username/hlstats/ /home/username/hlstats/daemon/ /home/username/hlstats/* # all the other file from the unpacked file /path/to/webroot/hlstats/class /path/to/webroot/hlstats/css /path/to/webroot/hlstats/hlstatsimg /path/to/webroot/hlstats/hlstatsinc /path/to/webroot/hlstats/lang /path/to/webroot/hlstats/signatures /path/to/webroot/hlstats/tmp /path/to/webroot/hlstats/hlstats.php /path/to/webroot/hlstats/sig.php /path/to/webroot/hlstats/xml.php Here we have unpacked the HLStats file into the home/hlstats folder. There we can keep all the files. This way we have not to care about unwanted access via the web. Then we moved or copied the contents of the web/ folder to our webroot folder. The daemon is now in /home/username/hlstats/daemon/hlstats.pl and can be addressed to launch it. Seperate the daemon and the web part on different Servers This can also be done. On one machine there is the daemon (even on a seperate folder or in the webroot) and on the other machine there will be the web part ( the contents of the web/ folder) More details and also a grphic can be found at the about page. The only common thing the the database, which can be on a seperate machine as well. ########################## ## Setup the database ########################## You can either create a complete new database or use an existing one. HLStats makes use of a table prefix, so a conflict with other tables will be avoided. If you are not sure how to create a database one, have a talk with your webhoster/admin. Next step would be to create a database user which has access to this database. If you are renting webspace your should have already a user and password. Even if you create a new database for this installation, a new user and password should be created already for you. IF NOT you can create a new database like this: mysqladmin create hlstats_db_name --user=root -p This will create a new database and will ask for the root user password. If you can not use the root user, you have to use an user which has the rights to create a new database. The next step would be to create a user with password for this database. You can create a new user and password like this: # mysql --user=root -p mysql> GRANT ALL ON hlstats_db_name.* TO 'username'@'localhost' IDENTIFIED BY 'some_password'; So we should have a database name, database user, database user password, by this point now. We need just one setting. The database hostname. Its usually localhost but in some cases it could be a special hostname e.g. db22.yourdomain.com. If you are unsure what your hostname is, ask your webhoster/admin about the mysql database hostname. All the database information we need are as follows: Database Hostname: "localhost" Database Name: "some_db_name" Database User: "some_user" Database User Password: "some_user_pass" Database table prefix: "hlstats" # or something else... Write them down we need them later on. Now we can use the hlstats.sql.with.placeholder file which is in the install folder. Copy the hlstats.sql.with.placeholder to hlstats.sql. This way we can revert if we foobar the process. cp hlstats.sql.with.placeholder hlstats.sql Open this file and REPLACE #DB_PREFIX# with your Database table prefix. Do a case sensitive search and replace and the result should like something like this: (...) DROP TABLE IF EXISTS `hlstats_Actions`; (...) Make sure you have replaced all the place-holders. Otherwise the sql will fail. Save it and use this modified version to install. Now we can finally create the required tables for HLStats. If you have access to a database admin tool like phpMyAdmin you can upload the file into the "Import" section and create the tables like this. If you are using a other tool you have to look for something to upload the sql file or pasting the content of the sql file into a textbox to execute the sql commands. If you are unsure what to do read the documentation of the tool which you are using. MAKE SURE YOU USE THE MODIFIED VERSION Here is the mysql command to create the required tables manually and if you have access to the mysql console: $ mysql --user=root -p some_db_name < web/install/sql_files/hlstats.sql Done. Keep the mysql access data noted somewhere. ########################## ## Configuration ########################## As of HLStats version 1.51 the browser based installation process has been droped. It has caused too much trouble and does not fit anymore. Perhaps it is a drawback but it should be much easier now and the security risk not having the installer sealed is gone. Configuration for the daemon (hlstats.pl) Move to the daemon folder (or if you have seperated the daemon to another location, to this location) Copy hlstats.conf.ini.example to hlstats.conf.ini Please not just rename it. It is much safer to have the default file available, if you accidently foobar the configuration. Read through the file and make the changes and settings according to the comments. Further explanation can be found in the file and in the reference. Configuration for the web interface After the configuration of the daemon we have to setup the webinterface, too. Move to your web/hlstatsinc folder. Copy hlstats.conf.example.php to hlstats.conf.php Please not just rename it. It is much safer to have the default file available, if you accidently foobar the configuration. Read through the file and make the changes and settings according to the comments. The web interface needs write access to the tmp/ and signatures/preRender/ folder ! ########################## ## Access to the web interface ########################## The web interface is ready for use now. You can access it with the following URL: http://www.your-domain.tld/path/to/index.php?mode=admin Login with the username and password from below. Make sure everything is working and no errors are visible. THEN change your password in the Admin users section !!! The default username and password provided with the hlstats.sql file: username: admin password: 123456 ########################## ## Add the game ########################## Now we need to add the required information about the game we want to record stats. Please read the additional information about the supported games, since some have some special things to care about ! Therefor log into the web interface (you should be there) and navigate to: Left Menu -> Gamesupport There you can select a game for which a gamesupport_* file is available. You can install a game only once yet. If a game is already installed it will not be listed in the dropdown, it will be listed in the dropdown for deleting a game. If you want to delete a game keep in mind that all the data and config will be deleted ! After you have added the game, the game will be available under Left Menu -> gameName -> Servers There you have to add the game server or even mutliple with the same game. The Rcon password is needed to provide some more detailed information in the server view. After saving you are ready to run the daemon and ready to provide some stats. ########################## ## Create the log stream ########################## Now we need to tell the game server to send log data to hlstats.pl daemon. We have to take care of the used version of the HL engine. Source Engine: (HL2, CS:S, DoD:S, etc.) log commands log Enables logging to file, console, and udp < on | off > logaddress_add Set address and port for remote host logaddress_del Remove address and port for remote host logaddress_delall Remove all udp addresses being logged to logaddress_list List all addresses currently being used by logaddress autoexec.cfg/server.cfg log on Turns Logging on logaddress_add 255.255.255.255:27500 Sends logs to your HLstats daemon Goldsrc Engine: (HL1, CS, TFC, etc.) log commands log Enables logging to file, console, and udp < on | off >. logaddress_add Set address and port for remote host . logaddress_del Remove address and port for remote host autoexec.cfg log on Turns Logging on logaddress_add 255.255.255.255 27500 Sends logs to your HLstats daemon Create the right log command into your autoexec.cfg and replace 255.255.255.255 with your IP from the PC on which hlstats.pl is running. Add the port which you have set up in the config files and you are allowed to use. ########################## ## Run the deamon ########################## There are several ways to start the daemon.(hlstats.pl) The most common way is to start it with the screen command. But for the first time and check if its working we start it as follow: cd /path/to/hlstats/daemon/ perl ./hlstats.pl Starting the daemon with the screen command: (you can skip this if you are starting for testing only) $ screen cd /path/to/hlstats/daemon/ perl ./hlstats.pl The result should look like this: ++ HLstats VERSION starting ++ -- Opening UDP listen socket on port PORT ... opened OK -- Connection to MySQL database 'DB_NAME' on 'DB_HOST' as user 'DB_USER' ... connected OK ++ HLstats is now running (MODE mode, debug level LEVEL) If not, then you have done something wrong. Check your settings and re-read the previous steps again. Perhaps you missed something. If you are still unsure what to do read the FAQ and then the Forum. There will be enough people to help you out. If everything went well continue to the next step. ########################## ## First run ########################## Now we have to check if everything is working. Fire up your daemon (if it is not already running) and leave it running. perl ./path/to/hlstats/daemon/hlstats.pl Start your gameserver and do some actions. There don't have to be players on the server yet. If everything goes well there should be log lines scrolling by in the hlstats.pl window by now. So do you see those lines ? Then you are done and ready to continue with the Admin Documentation. There we will cover adding and managing gamesupport to HLStats. If not check your configuration, hlstats.pl is still running and at least something is happening on your server.