DebianDebian Based

How To Install Fathom Analytics on Debian 12

Install Fathom Analytics on Debian 12

In this tutorial, we will show you how to install Fathom Analytics on Debian 12. In today’s digital landscape, website analytics play a crucial role in understanding user behavior and optimizing online experiences. However, many popular analytics solutions come with privacy concerns and complex implementations. Fathom Analytics offers a refreshing alternative – a privacy-focused, simple website analytics platform that respects user privacy while providing valuable insights.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Fathom Analytics on Debian 12 (Bookworm).


Before proceeding with the installation of Fathom on Debian 12, ensure you meet the following requirements:

  • A server running one of the following operating systems: Debian 12 (Bookworm).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for the Fathom Analytics.
  • A user account with sudo privileges to execute administrative commands.

Install Fathom Analytics on Debian 12 Bookworm

Step 1. To begin, we’ll install the necessary dependencies required for running Fathom Analytics on your Debian 12 server. Start by updating the Debian package repository to ensure you have access to the latest versions of the packages:

sudo apt update
sudo apt upgrade

Step 2. Installing Nginx and PostgreSQL

Next, install the following required packages:

  • PostgreSQL: A powerful open-source database system that Fathom Analytics relies on for storing data.
  • Nginx: A high-performance web server that will act as a reverse proxy for Fathom Analytics.
  • Certbot: A tool that simplifies the process of obtaining and managing SSL/TLS certificates from Let’s Encrypt.
  • UFW: A user-friendly firewall utility for managing network access to your server.

Run the following command to install these packages:

sudo apt install postgresql nginx certbot ufw

Step 3. Configure PostgreSQL Database.

Fathom Analytics uses a PostgreSQL database to store website analytics data. In this step, we’ll set up a dedicated database and user for Fathom.

Start by switching to the postgres user, which has administrative privileges for managing PostgreSQL:

sudo su - postgres

Create a new database for Fathom Analytics using the createdb command:

createdb fathom

Next, create a dedicated database user for Fathom and set a secure password:

createuser -P fathom

Grant the necessary privileges to the fathom user on the fathom database:

psql -c "GRANT ALL PRIVILEGES ON DATABASE fathom TO fathom;"

To allow the fathom user to authenticate with a password, modify the PostgreSQL configuration file. Open the pg_hba.conf file using a text editor:

nano /etc/postgresql/12/main/pg_hba.conf

Locate the line that starts with local and change the authentication method from peer to md5:

local all all md5

Save and close the file, then restart the PostgreSQL service to apply the changes:

sudo systemctl restart postgresql

Step 4. Installing Fathom Analytics on Debian 12.

Download the latest release of Fathom Analytics by visiting the official GitHub repository and copying the download link for the Linux binary. Use wget to download the archive:


Extract the downloaded archive and move the fathom binary to the /usr/local/bin directory:

tar xvf fathom-1.3.1-linux-amd64.tar.gz
sudo mv fathom /usr/local/bin/

To run Fathom Analytics securely, create a dedicated system user:

sudo useradd -r -s /usr/sbin/nologin fathom

Create the necessary directories for Fathom and set the appropriate ownership and permissions:

sudo mkdir -p /var/lib/fathom
sudo chown -R fathom:fathom /var/lib/fathom

Next, create a configuration file for Fathom Analytics. Open a new file called .env in the /var/lib/fathom directory:

sudo nano /var/lib/fathom/.env

Add the following lines to the file, replacing the placeholders with your specific configuration details:


Save the changes and exit the text editor, then create an admin user for accessing the Fathom Analytics web interface, run the following command:

sudo -u fathom fathom user add --email="" --password="YOUR_PASSWORD"

Replace with your desired email address and YOUR_PASSWORD with a strong password.

Step 5. Set Up Fathom Systemd Service.

To ensure that Fathom Analytics starts automatically on system boot and runs consistently, we’ll create a systemd service file.

Create a new file called fathom.service in the /etc/systemd/system directory:

sudo nano /etc/systemd/system/fathom.service

Add the following content to the file:

Description=Fathom Analytics

ExecStart=/usr/local/bin/fathom server


Save and close the file, then reload the systemd daemon to recognize the new service file:

sudo systemctl daemon-reload
sudo systemctl enable fathom
sudo systemctl start fathom

Step 5. Configure Nginx Reverse Proxy.

To securely access Fathom Analytics through a web browser, we’ll configure Nginx as a reverse proxy. This setup allows you to access Fathom using your domain name and enables HTTPS encryption.

Create a new Nginx server block configuration file:

sudo nano /etc/nginx/sites-available/fathom

Add the following content to the file, replacing with your actual domain name:

server {
listen 80;

location / {
proxy_pass http://localhost:9000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;

Save the changes and exit the text editor, then enable the new server block by creating a symbolic link:

sudo ln -s /etc/nginx/sites-available/fathom /etc/nginx/sites-enabled/

Next, obtain an SSL/TLS certificate using Certbot and Let’s Encrypt. Run the following command:

sudo certbot --nginx -d

Follow the interactive prompts to provide your email address and agree to the Let’s Encrypt terms of service. Certbot will automatically obtain and configure the SSL/TLS certificate for your domain.

Finally, restart the Nginx service to apply the changes:

sudo systemctl restart nginx

Step 6. Secure Installation with UFW Firewall.

To enhance the security of your Fathom Analytics installation, it’s crucial to configure a firewall. UFW (Uncomplicated Firewall) is a user-friendly frontend for managing firewall rules on Debian.

First, allow SSH access to ensure you can still connect to your server:

sudo ufw allow ssh

Next, allow incoming HTTP and HTTPS traffic:

sudo ufw allow http
sudo ufw allow https

Enable the UFW firewall:

sudo ufw enable

Step 7: Access Fathom Web Interface.

Congratulations! You have successfully installed Fathom Analytics on your Debian 12 server. Now it’s time to access the web interface and start tracking your website’s analytics. Open a web browser and navigate to your domain name (e.g.,

You should see the Fathom Analytics login page. Enter the email address and password you set for the admin user in Step 4, and click “Log In.”

Install Fathom Analytics on Debian 12 Bookworm

Congratulations! You have successfully installed Fathom. Thanks for using this tutorial to install the latest version of the Fathom Analytics on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official Fathom website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button