Install Piwik on Ubuntu 14.04

Browse by products and services

  • Applies to: DV Developer or self-managed VPS
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH with root access


This article explains how to install Piwik on your Media Temple VPS or dedicated server with Ubuntu 14.04. Piwik is a popular open-source website analytics utility. Full featured and completely free, Piwik is a great alternative to tools like Google Analytics.     

Please keep in mind that troubleshooting the configuration/functionality of third-party applications is not covered by our statement of support. These resources were provided as a courtesy to assist you to the extent of our abilities. For more information on our statement of support, feel free to click here.


  • A VPS with Ubuntu 14.04 installed
  • Root SSH Access
  • Familiarity with basic shell commands


Piwik requires PHP and a web server to work properly. If you are installing Piwik on the same server that you host your sites, you should already have a web server software like Apache or Nginx. However, this guide assumes a from-scratch install of Piwik on a fresh installation of Ubuntu 14.04. You can still use this guide if you already have a server set up to run your sites. If this is the case, you may skip to step 3.

1. Install Apache and the required PHP modules

Piwik requires a web server and PHP to work properly. It's possible that you already have these modules, but attempting to install them again will not negatively impact your server.

apt-get install apache2 libapache2-mod-php5 php5-json php5-mysqlnd php5-gd

2. Install and set up MariaDB

Piwik requires a database to work properly. These instructions are for MariaDB. There's no reason to change to MariaDB if you already have a different database utility installed. You will need to know your root MariaDB or MySQL password to complete Piwik installation.

apt-get install -y mariadb-server
  • Though not technically a requirement, it's important to complete the secure installation process. Don't forget to write down your root user password. Select "yes" at the end when prompted to reload privilege tables.

3. Create the Piwik database

Piwik requires a database to function. These instructions create a database named 'piwik'.

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

4. Update and restart Apache

apt-get update

service apache2 restart

5. Download and unzip Piwik


6. Modify permissions and move the Piwik files to the document root

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

$ sudo mv piwik /var/www/html/

7. Finish installing Piwik using your browser

Navigate to and follow the instructions.


8. System check

After clicking next, Piwik will run a check against your server's configuration to make sure that it is ready for the install. Make sure that the system check items are all green. Any missing items from the 'required' portion will prevent your install from being successfully completed. If you experience any issues, it may be helpful to reboot your server. 

9. Fill in the database info

Fill out the database form and select next.

Database Server: The default database server should be set to This is the localhost. 
Login: root
Password: Use the password that you set during MariaDB configuration in step 2.
Database name: The name used in step 3 is piwik. If you modified this, use that name instead.
Table prefix: Leave this as the default piwik_
Adapter: Leave this as default. (PDO\MYSQL)

10. Create your admin user

Do not use the same password that you used for your root database user. You will use this info to log into Piwik via

11. Installation complete!

Follow the instructions to add a site that you would like to track. This will generate a code that will need to be placed in the <head> section of your site. If you have any questions or concerns, please feel free to contact Media Temple's award winning 24/7 support. You may also want to consider checking out Piwik's official documentation.


Piwik website