How to install Fathom Analytics (website analytics) on Ubuntu

Published: 05 February 2023
on channel: Quickloss3
207
8

Update Server:
apt update && apt upgrade -y

Set hostname:
hostnamectl set-hostname ex.example.com

Downloading Fathom:
cd /tmp
curl -L -O https://github.com/usefathom/fathom/r...
sudo tar -C /usr/local/bin/ -xzf fathom*.tar.gz fathom
sudo chmod +x /usr/local/bin/fathom

Configuring and Running Fathom:
sudo adduser --system --group --home /opt/fathom fathom
cd /opt/fathom
sudo -u fathom bash
openssl rand --base64 32
nano /opt/fathom/.env
paste
FATHOM_SERVER_ADDR="127.0.0.1:8080"
FATHOM_DATABASE_DRIVER="sqlite3"
FATHOM_DATABASE_NAME="fathom.db"
FATHOM_SECRET="uXGz2OErWEriUNSBQOcnIsAlnpdciJc0n/uhXizc2ys="

fathom user add --email="your_email" --password="your_password"
exit fathom user


Setting Up Fathom as a Systemd Service:
sudo nano /etc/systemd/system/fathom.service
paste
[Unit]
Description=Fathom Analytics server
Requires=network.target
After=network.target

[Service]
Type=simple
User=fathom
Group=fathom
Restart=always
RestartSec=3
WorkingDirectory=/opt/fathom
ExecStart=/usr/local/bin/fathom server

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload
sudo systemctl enable fathom.service
sudo systemctl start fathom
sudo systemctl status fathom

Installing Nginx:
sudo apt update
sudo apt install nginx
sudo ufw allow "Nginx Full"
sudo nano /etc/nginx/sites-available/fathom.conf
paste
server {
listen 80;
listen [::]:80;
server_name ex.example.com;

access_log /var/log/nginx/fathom.access.log;
error_log /var/log/nginx/fathom.error.log;

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

sudo ln -s /etc/nginx/sites-available/fathom.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Access UI:
http://ex.example.com


Watch video How to install Fathom Analytics (website analytics) on Ubuntu online without registration, duration hours minute second in high quality. This video was added by user Quickloss3 05 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 207 once and liked it 8 people.