Install guide for HLStats 1.65 on CentOS 7
First, create a new virtual machine with the CentOS 7.X virtual machine. Use the CentOS 7 DVD that you can download from https://wiki.centos.org/Download
You don't need a lot of horse power for this VM so 10GB of disk and 1GB of memory is a good place to start.
Base Environment: Basic Web Server
Once the OS is installed and boots for the first time, install VMWare tools. That process goes like this
mount /dev/cdrom /mnt
cd ~
tar xvfz /mnt/VMWare<whatever date>.gz
cd vmware-tools/distrib
./vmware-install.pl
Just accept all the defaultsNext do an initial update with yum update and install all the available updates and reboot the machine
Next we need to install MariaDB (MySQL)
yum install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadbSome other pre-requisites that we need
yum install gcc
yum install php php-mysqliMake sure Apache starts on boot
systemctl start httpd
systemctl enable httpdCreate a user to run the HLStats daemon
useradd hlstatsSet the root MySQL user password
mysqladmin -u root password <password>Fetch HLStats and uncompress files to appropriate locations
wget http://www.hlstats-community.org/release/1.65/HLStats-1.65.tar.gz
tar xvfz HLStats-1.65.tar.gz
cd HLStats-1.65
mkdir /var/www/html/hlstats
cp -R web/* /var/www/html/hlstats/Now we need to create the hlstats database
mysqladmin create hlstats --user=root -pNow we need to grant the user access to the database to the hlstats user. Whatever you put for the password will need to be used for all the hlstat configuration files to follow.
mysql --user=root -p
GRANT ALL ON hlstats.* TO 'hlstats'@'localhost' IDENTIFIED BY 'password';
exitNow let's work on building the database
cd install
cp hlstats.sql.with.placeholder hlstats.sqlEdit the SQL script with nano -w hlstats.sql and search and replace #DB_PREFIX# with hlstats and save. Then run the script to create the database with:
mysql --user=root -p hlstats < hlstats.sqlLet's move on to the configuration of the daemon
cd ../daemon
cp hlstats.conf.ini.sample hlstats.conf.ini
nano -w hlstats.conf.iniSet the DBUsername, DBPassword and DBPrefix based upon the configuration done above and save.
Now we need to configure the web interface to talk to the database as well.
cd /var/www/html/hlstats/hlstatsinc
cp hlstats.conf.example.php hlstats.conf.php
nano -w hlstats.conf.phpSet the DB parameters in a similar fashion
Let's open up the port 80 on the firewall
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reloadifconfig to see what your internal IP address is. From your workstation running windows
http:///hlstats/index.php?mode=admin
username: admin password: 123456
Let's install the PERL modules that we're going to need
yum install perl-CPAN
perl -MCPAN -e shellChoose all the defaults. Once screen prompt appears run all of these commands.
install Bundle::DBI
install Config::Tiny
install Digest::MD5
quitOpen the port for the HLStats daemon to receive logs
firewall-cmd --zone=public --add-port=27500/udp --permanent
firewall-cmd --reloadLet's run the daemon as a different user so we'll move those files
cd ~
mv HLStats-1.65 ~hlstats/
chown hlstats.hlstats ~hlstats/HLStats-1.65Let's shift from root to the hlstats user and test some things out
su - hlstats
cd ~/HLStats-1.65/daemon/
perl ./hlstats.plMake sure it fires up successfully then CTRL-C it
Create hlstats.sh that looks like this:
#!/bin/bash
cd ~/HLStats-1.65/daemon/
while true; do nohup perl ./hlstats.pl; sleep 5; done &Give the file permissions
chmod u+x ./hlstats.shReturn to the root user by typing exit
Let's make this start up. First make rc.local executable
chmod u+x /etc/rc.d/rc.localLet's edit the startup script
nano -w /etc/rc.d/rc.localAdd this line to the bottom of it
su -s /bin/bash -c "/home/hlstats/HLStats-1.65/daemon/hlstats.sh" hlstats &Save the file then reboot Test that when the machine starts that it's listening on the web and daemon ports
netstat -a -n | egrep "80|27500"