Site icon installvirtual

How to install piwik analytics tools on Ubuntu 16.04

In this tutorial I will show you how to install piwik on Ubuntu 16.04 .   install piwik on ubuntu

Piwik is the leading Free/Libre open analytics platform.

Piwik is a full featured PHP MySQL software program that you download and install on your own webserver. At the end of the five minute installation process you will be given a JavaScript code. Simply copy and paste this tag on websites you wish to track and access your analytics reports in real time.

Piwik aims to be a Free software alternative to Google Analytics, and is already used on more than 1,000,000 websites. Privacy is built-in!

Prequisites for piwik

There are some requirements that we need before installing piwik analytics tool. Let’s see what we need.

From Piwik website:

Install Apache, php and mysql

In this step we will install install apache, php and mysql-server if it is not installed before.

sudo apt-get install wget php7.0 php7.0-curl php7.0-gd php7.0-cli mysql-server php7.0-mysql php-xml php7.0-mbstring libapache2-mod-php

You need to provide MySQL root user password while installation.

Read Also: How to install piwik analytics tool on centos 7?

Setting up database

Start the services of database

systemctl start mysql
systemctl enable mysql

Read Also: Useful s3 commands

Create database for piwik

Execute the following commands to create a database with user piwik and password. You should change password with some super secure password as I used this password for tutorial purpose only.

mysql -u root -p
mysql> CREATE DATABASE piwik;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES,
mysql> LOCK TABLES ON piwik.* TO 'piwik'@'localhost';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit
Bye

Installing piwik

Firstly we will download the zip of piwik from their website. You can also download zip from here:

cd /var/www/html
wget https://builds.piwik.org/piwik.zip
unzip piwik.zip

Change the conf  for php

By default apache2 look for index.html so we need to change the priority of index.php. Open the conf dir and make changes as below:

vim /etc/apache2/mods-enabled/dir.conf

I will look like this:

<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

We need to change the position of index.php on the first place as shown below:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

Starting Apache

systemctl start apache2
systemctl enable apache2

Web Console

You can go to the following link to get the web console

http://ip-or-hostname/piwik

Now you can configure piwik.

This is how you can install piwik analytics tool on Ubuntu.

Read Also: How to install bucardo for postgres replication

If you got some issues installing this tutorial please feel to comment below.

Exit mobile version