Introduction
Plausible Analytics is an open-source, self-hosted lightweight, and privacy-friendly web analytics tool. The platform track website visitors and get valuable statistics to help improve end-user experience. It stores data in ClickHouse and PostgreSQL Databases. The tool even helps users to monitor traffic with monthly/weekly reports and get notifications about any hacking activity in real time.
This article will explain how to install Plausible Analytics on ubuntu 20.04.
Prerequisites
- A non-root user with
sudo
privileges. - Ubuntu 20.04 systems with at least 2GB RAM.
Install Docker
The plausible Analytics repository is based on Docker so need to install docker. Run the following commands to install the docker.
- Update the system repository.
$ sudo apt-get update -y
$ sudo apt-get upgrade -y
- Install other dependencies.
$ sudo apt -y install apt-transport-https ca-certificates curl software-properties-common
- Add GPG key for Docker Repository.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
$ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" - Install docker by running the following command.
$ sudo apt -y install docker-ce
Install Docker Compose
- Installing Docker Compose using the below command.
$ curl -L https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
- Give file executable permission to docker-compose.
$ chmod +x /usr/local/bin/docker-compose
- Verify the installation of docker-compose by checking the version.
$ docker-compose version
Output:
Install Plausible Analytics
- Use the
cd
command to navigate into the/opt
directory.$ cd /opt
- Use git to clone the Plausible Analytics repository within
/opt
directory.$ sudo apt install git -y
$ git clone https://github.com/plausible/hosting - Navigate to
hosting
directory.$ cd hosting
- Generating a 64-character random secret key.
$ openssl rand -base64 64
- Open a plausible configuration file.
$ sudo vi plausible-conf.env
Add your server IP precede withhttp://
in the base URL, and random characters you generated withopenssl
in the secret_key_base then save and close the file. - Run the docker-compose using the below command to launch the containers.
$ docker-compose up
Output: - Now Plausible Analytics will be accessible at http://<your-server-ip-address>:8000 on the web browser.