Install Piwik on CentOS 5

From CSLabsWiki
Revision as of 17:18, 28 March 2011 by Deanejm (talk | contribs) (Finished tutorial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page summarizes how to perform a basic installation of Piwik on CentOS 5. This tutorial assumes you have root/sudo access.

Unpacking the Files

  • Navigate to /var/www
  • Download and unpack the files
  • Give Piwik Permission to Access its Folder
    • chmod -R g+w piwik/
    • chgrp -R apache piwik/
  • Install the following packages: php-json, php-dom, php-gd, and php-mbstring
  • Configure Apache to recognize the piwik directory
    • Open /etc/httpd/conf.d/piwik.conf
    • Paste in the following:
Alias /piwik /var/www/piwik/

<Directory /var/www/piwik/>
  Options ExecCGI
  Order allow,deny
  Allow from all
  AddType application/x-httpd-php .php
  php_flag magic_quotes_gpc on
  php_flag track_vars on
  • Restart httpd
    • /etc/init.d/httpd restart

Configure MySQL for Piwik Installation

  • Create the piwik database, user, and allow the piwik user to access the database
    • CREATE DATABASE piwik;
    • CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'insert password here';
    • GRANT ALL ON piwik.* TO 'piwik'@'localhost';
  • Exit MySQL

Install Piwik

  • Piwik Installation Guide
  • Navigate to the location where Piwik is installed with a web browser (for example,
  • Follow the prompts in the installation screens
    • Note: the php time zone detection support will give a warning; this is OK as time zones can be set manually
    • For the database setup, use the following:
      • database server: localhost
      • login: piwik
      • password: whatever you set while configuring MySQL
      • database name: piwik
      • table prefix: piwik_
      • adapter: PDO_MYSQL
  • The create a super user step of installation creates the administrator for piwik
  • Set up the first website during installation and paste the tracking code into the page (note: each site you monitor will need different tracking code)
  • To set forced SSL during login (note: forcing SSL via Apache configuration files will break Piwik's visitor tracking):
    • Open /var/www/piwik/config/config.ini.php
    • Under the username, email, and password for the superuser, add the following: