Open In App

How to Install Piwik (Alternative to Google Analytics) in Linux

Last Updated : 02 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Piwik is open-source software. It is currently known as the Matomo software. Piwik is the older version of this software product. Formerly, Matomo is known as the Piwik. Matomo is also known as Piwik Pro. Means, Piwik, Matomo, and Piwik Pro all are the same things with different names. Piwik is a web analytics software. It can be an alternative to Google Analytics. It is developed by a group of developers throughout the globe. It mainly runs on PHP & MySQL. Generally, it visits a certain website which users will provide to it. Then it will analyze the website & generate a report of it. For installing Piwik in the machine, the Apache server needs to be installed in the machine previously.

Features of Piwik:

  • Piwik provides a wide analysis of the website. Such as how many visitors visit the website per day, month, or year. Also, it can able to provide a real-time view of the website.
  • Piwik provides a beautiful user interface. By which users can able to navigate to every website where Piwik is running for analysis purposes.
  • Even, Piwik can be used for E-Commerce websites also. It can analysis the profit or loss for any certain business website also.

Installation & Configuration of Piwik on Linux

Step 1: At first, we have to open the terminal Linux. There we have to run the following command. This will help to install the Piwik in the machine. Piwik will go to be downloaded in the .zip file. We have to wait till the process is completed.

wget https://builds.matomo.org/piwik.zip

 

Step 2: Then after downloading the .zip file, we have to run the following command. This will help to extract the .zip file.

unzip piwik.zip

 

Step 3: Extracting the .zip file will a long time. We have to wait till the process is completed.

 

Step 4: After extracting the Piwik, we have to move it to a certain directory. For moving it we need to run the below command. Then we have to switch to a certain directory. For that purpose, we need to run the second command. These commands will not provide any output. Simply, it will do the job. After running those commands we can visualize that our directory has changed.

mv piwik /var/www/
cd /var/www/

 

Step 5: Then we have to change the ownership of the file. As well as we need to change the permission. The first command will change the ownership of Piwik & the second command will change the permission required for running Piwik on the machine. Both these commands will not provide any output. They will simply do the work.

chown -R www-data.www-data piwik
chmod -R 775 piwik

 

Note: The above step is very important. Users should perform the step by paying attention to it. Any mistakes made in this case will hamper the installation of Piwik. It will not only hamper the installation of Piwik in this attempt but also in the future when users want to again install Piwik in that machine, then again it will prompt an error. So, it is advisable to perform it cautiously.

Step 6: Then we have to run the following command. This will open an editor-like window in front of the users. The terminal window will get open. There we have to configure something important.

vim /etc/apache2/sites-available/piwik.conf

 

Step 7: Then we have to write the following items in that editor window. This is needed for the configuration purpose in the Apache server. As per the user’s choice they can change the server name. The items are written below. Users can just copy & paste it over the editor. After writing all the items, we just need to press Enter. Hence, the editor window will get closed & it will return to the original terminal window.

< VirtualHost \*:80> 
ServerName www.linux.com
DocumentRoot /var/www/piwik/
< Directory /var/www/piwik/> 
AllowOverride All
allow from all
< /Directory> 
< /VirtualHost>

 

Note: Users please don’t make any changes to any other part of the configuration. If needed, users can only change the ServerName. Users don’t need to afraid of the same ServerName problem. Suppose, users have already given the same server name to some other software & for Piwik also they have given the same ServerName. In that case also, there will not any problem when they open that server. But please don’t make any changes other than the ServerName. It can lead to unsuccessful installation of Piwik.

Step 8: Now, after all, the configuration, we need to activate the new server. For that purpose, users need to execute the following command. It will take a small amount of time.

a2ensite piwik.conf

 

Step 9: Now, after activating the new server, we need to disable the default Apache server. For that purpose, we need to run the following command. It will also take small amount of time to complete.

a2dissite 000-default.conf

 

Note: For installing any server previously, if the users already disabled the Apache Server, then also they can perform the step. It will not hamper any thing. It is advisable to perform this step even if user already disabled the Apache Server

Step 10: Now, we have to rewrite or save the changes which we have made in the Apache server. For that purpose, we need to execute the following command. It will save the changes.

a2enmod rewrite

 

Step 11: After saving the changes, it is always a good practice to restart the application. In this case also, for Apache Server, we need to restart it. For restarting purposes, we need to run the below command. It will not prompt anything. It will just simply, restart the Apache.

systemctl restart apache2

 

Step 12: Now, we have installed the Piwik in the machine. Now, we will open the browser & search for our ServerName. Here in this case ServerName is “www.linux.com”. After searching for it, it will provide the home page of Piwik. As Piwik is now known as Matomo, it will be redirected to the Matomo home page. Hence, the installation of Piwik is successful.

 

Some More Configurations (Tasks)

After installing Piwik in the machine some simple configurations need to be carried out. We can assume those configurations as some simple tasks. Though in many tasks we need to just press Next, there are some tasks where a guideline will be better for the users. Here, we will list those tasks in a step-by-step manner.

1. System Check Task

Note: Here, we don’t need to make any changes. Here, we just scroll down the page & need to click on Next. Though it is a simple task, but as the name suggest “System Check”, some users might get confused. That is why a guideline is necessary.

Step 1: After the Welcome Page, it will redirect to the System check page. There Piwik will automatically check the needed packages & software are available there or not. That will be a long list. In normal cases, all these things go well. As if there is any problem, Piwik will prompt an error while installing.

 

Step 2: We have to just scroll down to the page. There we will find the Next button. We have to press that. Hence, we have completed this task.

 

2. Super User Task

Super user task is not a difficult task. Here, all the tasks are listed in some different way. It is the same step which we perform while using MySQL.

Step 1: In this task, we need to first provide the user name. This user name will necessary when the user again visits Piwik or when they want to make any changes. Also, along with the username, we have to provide a password & confirm it.

 

Step 2: Then we have to provide the email address of the user. It is not so important but a required one. By this email address, Piwik can send the user the newsletter. At any point in time users can unsubscribe from the newsletter. And then we have to press Next

 

Note: We don’t need to click on the Checkboxes provided there. Make those empty & directly click on Next.

3. Setup A Website Task

Step 1: In this task, we need to just enter the necessary details. Like here, we have to write the website name. Users can provide any name. 

Step 2: Also, we have to provide the website URL. This should be the same URL that we have given earlier. In this case, our URL was “www.linux.com”. So, we have to write the same thing.

Step 3: Then we have to provide the location of the user.

Step 4: At last, it will ask for E-commerce. It is recommended not to change this thing. It will always be in Enabled mode. Changing its mode may hamper the working of Piwik. Then we have to click Next.

 



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads