Install Piwik - A Free Website Traffic Analytics Tool in Ubuntu 14.04

Today I will cover the installation of Piwik on Ubuntu 14.04. Piwik is a free and open source web analytics application that runs on a webserver that support PHP and has a MySQL database. It provides detailed analytics about your website visitors that you can store on your own server. Among many things it provides real time data updates, analytics for e-commerce websites, goal conversion tracking, event tracking, site search analytics, geolocation and a lot of other information.

How to Install Piwik

Before starting the installation you will first have to create a MySQL database and username to use for the data, to do so follow this simple steps:

$ mysql -u root -p
mysql> CREATE DATABASE piwik;
mysql> CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'foopass';
mysql> exit

piwik create db

Note: Please change foopass to your own password or a generated one.

You can get the latest version from piwik download page with wget and use unzip to decompress it. (In case you don't have unzip installed on your system you can use the command "apt-get install unzip" to install it):

$ wget
$ unzip

And next you can move the folder to a directory accessible by the Apache server, by default /var/www/html:

$ sudo chown www-data:www-data -R piwik
$ sudo mv piwik /var/www/html/

Note : You can set this directory as sub domain so you could access as example "" by setting A record in your DNS to the piwik directory.


You can now access the installation script by accessing http://IP_OF_YOUR_SERVER/piwik using your web browser like this:

piwik install welcome

Click on the Next button and you will be presented with a system check, read the page and see if there are any problems, if there aren't any wrong permissions or any extra packages that need to be install you can click the Next button again

piwik system check

On the next screen you will have to input the MySQL information for the username and database you created earlier:

piwik database

After it will create the database the application will ask you to create the administrative account that you will use to manage and view website reports:

piwik admin

After this you will be ask to provide information about the first website you wish to monitor, take note that you can add as many websites as you wish after the initial configuration is finished:

piwik first website

Next you will be presented with a tracking code, this code must be included in the files of your website, and you will have to include it on all pages of the website for the tracking to work efficiently:

pwiki track code

This will finish the installation and redirect you the login screen of your piwik installation that will allow you to access the main interface:


Now you can have full analytics at your disposable without relying on external services. Piwik website also offers an integration page from where you can download plugins that will help you use it on various platforms such as WordPress, Drupal, Joomla and many many more.

Adrian Dinu 11:00 am

About Adrian Dinu

I’ve been a Linux enthusiast since 1998 and been working as a Linux Admin in the past 8 years with a lot of love for computers and networks.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.