How to Install Piwik (Alternative to Google Analytics) in Linux
Last Updated :
02 Aug, 2022
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.
Similar Reads
How to Install Google Analytics in WordPress ?
Google Analytics is a powerful tool that helps you understand your website's traffic and user behaviour. By installing Google Analytics on your WordPress site, you can gain valuable insights to improve your content, enhance user experience, and boost your site's performance. This guide will walk you
3 min read
How to Install Brave Browser In Linux Mint
Brave is an open-source, cross-platform, and free web browser developed by Brave Software, Inc. based on the Chromium web browser. Brave web browser mainly focuses on privacy, this browser automatically blocks online advertisements and trackers on websites in settings that come in default. The brave
2 min read
How To Add Google Analytics in React?
Integrating Google Analytics into a React application enables you to monitor and analyze your websiteâs traffic and user behavior. This integration offers valuable insights into user interactions on your site, aiding in making informed decisions to enhance user experience and achieve business object
3 min read
How to Install Darktable in Linux
Darktable is a free and open-source photographic workflow program and RAW developer. A photographer's virtual light table and darkroom. It keeps track of your digital negatives in a database, allows you to examine them on a zoomable light table, and allows you to develop raw photographs and improve
2 min read
How to Install python-gadfly in Linux?
In this article, we will be looking at the stepwise procedure to install the python-gadfly for Python in Linux. Gadfly is a relational database management system written in Python. Gadfly is a collection of Python modules that provides relational database functionality entirely implemented in Python
2 min read
How to Install Ghost_Eye Tool in Kali Linux ?
GhostEye is an information gathering, footprinting, scanner, and Reconnaissance tool built with Python 3. It captures information about the target and gives us detailed information about our objectives. It only requires a domain or IP address. GhostEye is compatible with all Linux distributions. Fea
5 min read
How to Install Software Applications in Linux?
Linux offers a flexible and powerful environment for running software, but if you're new to the platform, you might wonder how to install software in Linux. Unlike other operating systems, Linux provides multiple ways to install applications, whether through package managers, terminal commands, or g
7 min read
How to Install Gekko In Python on Linux?
In this article, we will learn how to install Gekko in Python on Linux. GEKKO is a Python package for machine learning and optimization of mixed-integer and differential-algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed-integer programming (LP, Q
2 min read
How to Add Google Analytics to a Next.js Application?
Adding Google Analytics to a Next.js application allows you to track and analyze your website's traffic and user actions. This can provide valuable insights into how users interact with your site, helping you make informed decisions to improve user experience and drive business goals. This article h
3 min read
How to Install DataGrip in Linux
DataGrip is a database platform that supports several engines. MySQL, PostgreSQL, MS SQL Server, Oracle, Sybase, DB2, SQLite, HyperSQL, Apache Derby, and H2 are among the databases it supports. It comes with an editor that contains features like auto-completion, analysis, and navigation to help you
2 min read