Plausible is a free and open-source web analytics tool that helps you to track your website visitors. This lightweight solution is an alternative to Google Analytics. With Plausible, you can see all your site stats and metrics on a modern-looking, simple-to-use, and fast-loading dashboard. It is self-hosted, which means you can install it on any physical or virtual private server.

In this post, we will show how to install Plausible Analytics with Docker on Ubuntu 20.04.

Step 1 – Install Docker CE and Docker Compose

Before starting, you will need to install Docker CE and Docker compose on your server. By default, the latest Docker CE package is not available in the Ubuntu 20.04 default repository, so you will need to add the Docker CE official repository to your server.

First, install all required dependencies with the following command:

apt-get update -y
apt-get install git apt-transport-https ca-certificates curl software-properties-common -y

Next, add the GPG key and repository with the following command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Once the repository has been added, install Docker and Docker Compose with the following command:

apt-get install docker-ce docker-compose -y

Once the installation is completed, verify the Docker version with the following command:

docker --version

You should see the following output:

Docker version 20.10.5, build 55c4c88

Step 2 – Download Plausible

Next, you will need to download Plausible from the Git repository. You can download it with the following command:

git clone https://github.com/plausible/hosting

Once the download is completed, change the directory to the downloaded directory and generate a secrete password with the following command:

cd hosting
openssl rand -base64 64

You should get the following output:

ZWOn9ulvt24T0nJUpZsyIyAL16AdyZWzY3bpw0sL/c5KuAUCNruX8JhQeMLJcJ8Y
51UtPG4/r8nXFxv0A67rWA==

Next, edit the Plausible environment configuration file and define your email, admin username, password, and secret key:

nano plausible-conf.env

Change the following lines:

[email protected]
ADMIN_USER_NAME=admin
ADMIN_USER_PWD=adminpassword
BASE_URL=http://plausible.example.com
SECRET_KEY_BASE=ZWOn9ulvt24T0nJUpZsyIyAL16AdyZWzY3bpw0sL/c5KuAUCNruX8JhQeMLJcJ8Y51UtPG4/r8nXFxv0A67rWA==

Save and close the file when you are finished.

Step 3 – Launch the Plausible Container

Next, you will need to run a docker-compose command inside the hosting directory to launch the Plausible container:

docker-compose up --detach

You should get the following output:

Digest: sha256:ab22a669cfe20cb54fa0d237f8ff7592793204d16ea5f588ceef4f63639cfc24
Status: Downloaded newer image for plausible/analytics:latest
Creating hosting_mail_1                ... done
Creating hosting_plausible_events_db_1 ... done
Creating hosting_plausible_db_1        ... done
Creating hosting_plausible_1           ... done

You can check all Docker images downloaded by the above command as shown below:

docker images

Output:

REPOSITORY                 TAG       IMAGE ID       CREATED       SIZE
yandex/clickhouse-server   latest    eeafa0a212bf   2 days ago    557MB
postgres                   12        85f1c84fe307   2 weeks ago   314MB
plausible/analytics        latest    213327b74c3b   5 weeks ago   149MB
bytemark/smtp              latest    cd5c77c3bcd8   2 years ago   130MB

Now, check all the running containers with the following command:

docker ps

Output:

CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS         PORTS                          NAMES
071b49800d01   plausible/analytics:latest        "/entrypoint.sh sh -…"   7 seconds ago    Up 5 seconds   0.0.0.0:8000->8000/tcp         hosting_plausible_1
0cdae715308b   postgres:12                       "docker-entrypoint.s…"   18 minutes ago   Up 6 seconds   5432/tcp                       hosting_plausible_db_1
90fb544b4425   yandex/clickhouse-server:latest   "/entrypoint.sh"         18 minutes ago   Up 6 seconds   8123/tcp, 9000/tcp, 9009/tcp   hosting_plausible_events_db_1
750a908682be   bytemark/smtp                     "docker-entrypoint.s…"   18 minutes ago   Up 7 seconds   25/tcp                         hosting_mail_1

Step 4 – Access Plausible Web Interface

At this point, the Plausible container is started and listening on port 8000. You can access it using the URL http://plausible.example.com:8000.

Click on the Register button to register in Plausible and start working.

Conclusion

Congratulations! You have successfully installed Plausible analytics on Ubuntu 20.04. You can now add your website and track the website visitors from the central dashboard from your Atlantic.Net VPS.