Piwik is a powerful real time web analytics application that has similarities with Google Analytics. Piwiki allows users to have detailed reports on your visitors like statistics about keywords & search engines used, web browser & OS, language used, etc. You can find all features here.

If you want to test Piwiki under a server running Ubuntu (12.04/11.10/11.04 or older), then this tutorial will help you out. To be able to run Piwiki under Ubuntu, you need first to install the LAMP web server. The tutorial here will help you install LAMP under Ubuntu.

1. Creating A MySQL Database For Piwiki


mysql -u root -p

create database piwiki;

CREATE USER 'piwiki'@'localhost' IDENTIFIED BY '12345';


These commands will create the follwoing MySQL database details:

  • MySQL user: piwiki
  • Database name: piwiki
  • Password: 12345   ---> You can replace it to any password of your choice in the last two  commands.
To exit the MySQL server, run simply this command:


2. Piwiki Installation

To setup Piwik locally, run this sequence of commands:

cd /tmp && wget -O Piwik.zip http://goo.gl/sKmC6

sudo unzip Piwik.zip -d /var/www

sudo chown -R www-data:www-data /var/www/piwik

sudo mkdir /var/www/piwik/tmp/templates_c/

sudo mkdir /var/www/piwik/tmp/cache/

sudo mkdir /var/www/piwik/tmp/assets/

sudo mkdir /var/www/piwik/tmp/tcpdf/

Run now these commands to change permission of the following folders:

sudo chown -R www-data:www-data /var/www/piwik

sudo chmod a+rw /var/www/piwik/tmp

sudo chmod a+rw /var/www/piwik/tmp/templates_c/

sudo chmod a+rw /var/www/piwik/tmp/cache/

sudo chmod a+rw /var/www/piwik/tmp/assets/

sudo chmod a+rw /var/www/piwik/tmp/tcpdf/

Add now PHP GD support to Apache with these commands:

sudo apt-get install php5-gd

sudo /etc/init.d/apache2 restart

Start now the installation of Piwikfrom this link:


In the "Database Setup" page, enter the MySQL database details we have created above:

In the "Super User" provide your login access details:

You will be then provided with a JavaScript tracking code that you can place in your web pages:

Login then to your admin area using details entered during the installation of Piwiki to start tracking your visitors:


That's it!