How to install Piwik on a CentOS VPS

Leave reply

This article covers the installation of Piwik on a CentOS VPS. The installation is quite easy and fast, and can be done by anyone.

Piwik is a free web analytics software used by more than 300,000 websites worldwide. Piwik provides detailed real time reports on your website’s visitors, your visitors’ geo location, your marketing campaigns, and much more…

Minimum requirements to run Piwik on your CentOS linux vps are PHP version 5.1.3 or greater, MySQL version 4.1 or greater and the PHP ‘mysqli’ which is enabled by default.

You can check your PHP version by executing:

# php -v

You can check your MySQL version by executing:

# mysql -V

If your server meets the minimum requirements you can start with the installation.

Download the latest Piwik release from their official website:

# wget http://piwik.org/latest.zip

Unzip the downloaded zip file to the Apache’s document root directory:

# unzip latest.zip -d /var/www/html

If you are not sure about the location of the Apache’s document root directory, you can execute:

# grep -i '^documentroot' /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"

In our case it is the ‘/var/www/html’ directory.

This will create a new ‘piwik’ directory. This directory should be owned by ‘apache’:

# chown -R apache:apache /var/www/html/piwik

Setup a new MySQL user and create a new MySQL database using the following commands:

# echo "CREATE DATABASE piwikdb;" | mysql -u root -p
# echo "CREATE USER 'piwikuser'@'localhost' IDENTIFIED BY 'PASSWORD';" | mysql -u root -p
# echo "GRANT ALL PRIVILEGES ON piwikdb.* TO 'piwikuser'@'localhost';" | mysql -u root -p
# echo "FLUSH PRIVILEGES;" | mysql -u root -p

Do not forget to change ‘PASSWORD’ with you actual password.

The next step is to navigate your browser to http://yourdomain.com/piwik and finish the installation using the web interface. You will be prompted to setup the MySQL database, create a new super user, setup your website’s name and URL, etc…

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


50% OFF Coupon

EXCLUSIVE EMAIL UPDATES AND “MEMBERS-ONLY” CONTENT


2 Responses to “How to install Piwik on a CentOS VPS”

  1. 100+ self-hosted alternatives to popular services | RoseHosting.com Linux VPS Hosting Blog

    […] Piwik – One of the favorite alternatives to Google Analytics. Used by many, loved by all. Customizable, extensive, with an easy-to-use user interface. Oh, yeah, and another thing – it’s 100% free and open source! […]

    Reply

Leave a Reply