In this tutorial, we'll learn how to set up Plausible analytics on AlmaLinux 10 via Docker.
More developers and businesses are turning to Plausible Analytics as a clean, lightweight, and ethical alternative to Google Analytics. In this tutorial, we’ll walk through how to set up a fully self-hosted instance of Plausible Analytics on an Ubuntu 24.04 server using Docker and Docker Compose. This allows us to retain full ownership of our analytics data, comply with privacy laws like GDPR, and offer a transparent experience for our users.
Why Use Plausible Analytics?
Plausible is open-source and designed with simplicity and privacy in mind. Unlike traditional tools, it doesn’t use cookies or track personal data. By hosting Plausible ourselves, we gain:
- Full control over analytics data
- Lightweight, privacy-respecting JavaScript snippet
- No need for annoying cookie banners
- Transparent operations aligned with privacy laws
Prerequisites
Before we begin, let’s ensure our environment meets the following requirements:
- A AlmaLinux 10 installed dedicated server or KVM VPS.
- A non-root user with sudo privileges.
- Basic knowledge of using the terminal.
Set up Plausible Analytics on AlmaLinux 10 via Docker
Step 1: Update Our AlmaLinux 10 System
Update System Packages:
sudo dnf update -y
Step 2: Install Docker and Docker Compose
Plausible Analytics is designed to run efficiently within Docker containers. We'll install Docker Engine and Docker Compose.
Install dnf-plugins-core:
This package provides the config-manager utility, which we'll use to add the Docker repository.
sudo dnf install -y dnf-plugins-core
Add the Docker Repository:
Docker is not included in AlmaLinux's default repositories. We need to add the official Docker CE (Community Edition) repository. Even though it specifies centos, AlmaLinux is binary compatible, so it works perfectly.
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker Engine and Docker Compose Plugin:
Now we can install the Docker Engine, CLI, containerd, and the Docker Compose plugin.
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Enable and Start Docker Service:
We need to enable Docker to start on boot and then start the service immediately.
sudo systemctl enable --now docker
Verify Docker Status:
To confirm that Docker is running correctly, we can check its status:
sudo systemctl status docker
We should see output indicating that the service is "active (running)".
Add Our User to the Docker Group (Optional but Recommended):
By default, only the root user or users with sudo privileges can execute Docker commands. To run Docker commands without sudo, we can add our current user to the docker group.
sudo usermod -aG docker ${USER}
After running this command, we'll need to log out of our SSH session and log back in for the changes to take effect. This refreshes our user's group memberships.
Let's run a simple test to ensure Docker is functioning as expected:
docker run hello-world
If successful, we'll see a "Hello from Docker!" message.
Step 3: Clone the Official Plausible Self-Hosting Repository
Plausible offers an official self-hosted setup via Docker Compose:
git clone -b v3.0.1 --single-branch https://github.com/plausible/community-edition plausible-ce
cd plausible-ce
This directory contains all the necessary Docker Compose files.
Step 4: Set Up Environment Variables
We now configure our .env file with secrets and details for our instance.
echo "BASE_URL=https://plausible.example.com" >> .env
echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
Make sure $BASE_URL
is set to the actual domain where you plan to host the service. The domain must have a DNS entry pointing to your server for proper resolution and automatic Let's Encrypt TLS certificate issuance. More on that in the next step.
Expose Plausible server to the web with a compose override file:
echo "HTTP_PORT=80" >> .env
echo "HTTPS_PORT=443" >> .env
Create compose.override.yml file
cat > compose.override.yml << EOF
services:
plausible:
ports:
- 80:80
- 443:443
EOF
Step 5: Launch Plausible
Now we’re ready to start the containers.
docker compose up -d
Check status:
docker compose ps
Docker will install SSL certificate automaticating. If all services are running, visit your domain:
https://plausible.example.com
Final Thoughts
In this tutorial, we've learnt how to set up Plausible analytics on AlmaLinux 10 via Docker. Plausible Analytics offers us a sustainable, privacy-first alternative to Google Analytics without sacrificing functionality. By self-hosting it on AlmaLinux 10 using Docker, we gain full data control and contribute to a more ethical web.