In this tutorial I will show you how to install piwik on Ubuntu 16.04 .
Piwik is the leading Free/Libre open analytics platform.
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:
- Webserver such as Apache, Nginx, etc.
- PHP version 5.5.9 or greater
- MySQL version 5.5 or greater, or MariaDB
- (enabled by default) PHP extension pdo and pdo_mysql, or the mysqli extension.
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.
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)
Firstly we will download the zip of piwik from their website. You can also download zip from here:
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:
I will look like this:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
We need to change the position of index.php on the first place as shown below:
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
systemctl start apache2
systemctl enable apache2
You can go to the following link to get the web console
Now you can configure piwik.
This is how you can install piwik analytics tool on Ubuntu.
If you got some issues installing this tutorial please feel to comment below.