Skip to main content

INSTALLING PIWIK 3.2.1 ON UBUNTU 16

PIWIK is a downloadable, Free (GPL licensed) web analytics software platform. It provides detailed reports on your website and its visitors, including the search engines and keywords they used, the language they speak, which pages they like, the files they download and so much more. PIWIK aims to be an open source alternative to Google Analytics.

To run Piwik your host needs a couple of things:
>Webserver such as Apache, Nginx, IIS, 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

First install apache2 package
#apt-get install apache2

Now install php and mysql-server packages
We are installing php 7.0 here since it is more memory efficient than older versions
#apt-get install php7.0 php7.0-curl php7.0-gd php7.0-cli mysql-server php7.0-mysql php-xml php7.0-mbstring  libapache2-mod-php7.0 php7.0-mcrypt php7.0-zip

#service apache2 start
#service mysql start

Set mysql database and user for piwik
mysql -u root -p
 mysql> CREATE DATABASE piwikdb;
mysql> grant all on piwikdb.* to  'piwikuser'@'localhost' IDENTIFIED BY 'redhat';
mysql> flush privileges;
mysql> exit

Download piwik package
#cd /tmp
Download latest piwik package.Here we are downloading Piwik 3.2.1.
# wget https://builds.piwik.org/piwik.zip
Unzip it to /var/www/html
#tar -xvzf piwik.zip -C /var/www/html/
Modify permissions
# chown www-data:www-data -R /var/www/html/piwik
Restart apache2 service
#service apache2 restart
Delete unwanted file
#rm /var/www/html/How to install Piwik.html

Now from your browser type http://your_pub_ip/piwik