In today’s article, we will install Open Web Analytics (OWA) on a CentOS 7 VPS. Open Web Analytics (OWA) is an open source web analytics software that you can use to track and analyze how people use their websites and applications. It is written in PHP and uses a MySQL database. OWA is similar to Google Analytics, although it is a server software, anyone can install and run it on a Linux VPS.
We will be using our SSD Linux VPS for this tutorial.
Login to the server using SSH:
ssh [email protected]_ip
Before starting, enter the following command to check if you have the correct version of CentOS installed on your machine:
the command should output the data to you at the bottom:
CentOS Linux release 7.2.1511 (Core)
Update the system
Make sure your server is fully up to date:
Installing OPEN WEB ANALYTICS
We will download the OWA Zip archive from the directory / opt… You can get the most recent version here…
Run the following commands:
cd /opt wget https://github.com/padams/Open-Web-Analytics/archive/1.6.0.zip
Unpack the downloaded archive. If you cannot unpack, install the archiver on your server, you can do it with: yum install unzip
Rename the unpacked directory to a more suitable one that is easier to remember. The following command does exactly that, moves the directory to the document root of the Apache server ( / Var / WWW / HTML ):
mv Open-Web-Analytics-1.6.0/ /var/www/html/owa/
Enter the directory:
The next step is to create a database for OWA. But before you do this, if you don’t have an active MySQL root password, don’t wait, run the script after installation ‘mysql_secure_installation ‘to set a password for root:
# mysql_secure_installation - Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
So, you’ve just configured the MySQL root password to your liking. The next thing you need to do is create a real OWA database. Login to your MySQL service as root and execute the following queries:
# mysql -u root -p mysql> create database owa; mysql> grant all privileges on owa.* to [email protected] identified by 'your_password'; mysql> flush privileges; mysql> exit Bye
Now you can create an Apache virtual host configuration for the domain that will be used to access OWA. Open the file with your text editor. We use nano:
Now paste in the following:
<VirtualHost *:80> ServerAdmin [email protected]_domain.com DocumentRoot "/var/www/html/owa/" ServerName your_domain.com ServerAlias www.your_domain.com ErrorLog "/var/log/httpd/your_domain.com-error_log" CustomLog "/var/log/httpd/your_domain.com-access_log" combined <Directory "/var/www/html/owa/"> DirectoryIndex index.html index.php Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
Don’t forget to change your_domain to a valid domain name. Save and close the file. Restart Apache for the changes to take effect:
service httpd restart
However, we are not done yet. There is a tiny thing to do. Create a configuration file for OWA. Copy owa-config-dist.php to new file OWA-config.php:
cp owa-config-dist.php owa-config.php
Now, using a text editor, open the file and update the database and URL values for the OWA installation. The updated values should look like those listed below:
/** * DATABASE CONFIGURATION * * Connection info for databases that will be used by OWA. * */ define('OWA_DB_TYPE', 'mysql'); // options: mysql define('OWA_DB_NAME', 'owa'); // name of the database define('OWA_DB_HOST', 'localhost'); // host name of the server housing the database define('OWA_DB_USER', 'owa'); // database user define('OWA_DB_PASSWORD', 'your_password'); // database user's password define('OWA_PUBLIC_URL', 'http://your_domain.com/');
Save and close the file. Last but not least, assign the correct ownership of the OWA directory.
chown apache: -R /var/www/html/owa/
Now open your favorite web browser and go to http://your_domain.com to complete the OWA installation. You will be greeted at the page as shown in the picture below.
Press on ” Let’s get started “. Enter the site domain, email address and password that will be valid for a user with administrator rights. Click the “Continue“.
You will receive a message “Success! That’s It. Installation is Complete“. Then click on the “Login and generate a site tracker‘
Congratulations. If you followed the tutorial, you now have a working open installation of Web Analytics that you can use to track your websites. You can check the OWA documentation for more information on software features, frameworks, etc …
PS … If you liked this post, please share it with your friends on social networks using the buttons on the left side of the post, or just leave a comment below. Thank you.