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 your 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 that anyone can install and run it on a Linux VPS.
We will be using our SSD 1 Linux VPS hosting plan for this tutorial.
Log in to your server via SSH:
# ssh [email protected]_ip
Before starting, enter the command below to check whether you have the proper version of CentOS installed on your machine:
# cat /etc/redhat-release
which should give you the underneath output:
CentOS Linux release 7.2.1511 (Core)
UPDATE THE SYSTEM
Make sure your server is fully up to date:
# yum update
INSTALL OPEN WEB ANALYTICS
We will download the OWA zip archive in the /opt directory. You can grab the latest version here.
Execute the below commands:
# cd /opt # wget https://github.com/padams/Open-Web-Analytics/archive/1.6.0.zip
Unzip the downloaded archive. If you don’t have unzip installed on your server, you can do it using: yum install unzip
# unzip 1.6.0.zip
Rename the unpacked directory into a more suitable and easier to remember value. The below command does exactly that and moves the directory into Apache’s document root (/var/www/html):
# mv Open-Web-Analytics-1.6.0/ /var/www/html/owa/
Enter the directory:
# cd /var/www/html/owa/
Your next step is to create a database for OWA. But before doing that, if you don’t have an active MySQL root password feel free to run the post-installation script ‘mysql_secure_installation’ in order to set a root password:
# 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. Next thing you need to do is to create the actual OWA database. Login to your MySQL service as root and execute the below 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
With this taken care of you can now create an Apache virtual host configuration for the domain you will use to access OWA. Using your favorite text editor open a file. We are using nano:
# nano /etc/httpd/conf.d/your_domain.conf
Now paste 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 the your_domain values with your actual domain name. Save and close the file. Restart Apache for the changes to take effect:
# service httpd restart
However, we are still not done. There is a tiny little thing to be done. Create a configuration file for OWA. Copy owa-config-dist.php to a new owa-config.php file:
# 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. When updated the values should look like the ones 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 proper ownership of the owa directory.
# chown apache: -R /var/www/html/owa/
Now open your favorite web browser and navigate to http://your_domain.com to finish the OWA installation. You will be welcomed by a page as shown in the image below.
Click on ‘Let’s Get Started‘. Enter the Site Domain, your email address and the password which will be valid for the admin user. Click on ‘Continue‘.
You will get a ‘Success! That’s It. Installation is Complete‘ message. Next, click on ‘Login and generate a site tracker‘
Congratulations. If you followed the tutorial closely you now have a working Open Web Analytics installation that you can use to track your websites. You may want to check OWA documentation for more info on the software features, framework etc…