Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Install Umami Analytics on Ubuntu 24.04

How to Install Umami Analytics on Ubuntu 24.04

If you’re looking to implement a simple, privacy-focused analytics solution on your Ubuntu 24.04 server, Umami Analytics is an excellent choice. It provides insightful website data without the complexity or privacy concerns associated with larger tools like Google Analytics. This guide walks you through installing Umami on Ubuntu 24.04, ensuring your website traffic analysis remains private and under your control. Before you begin, make sure your server has a fresh Ubuntu 24.04 installation, and you have root or sudo access to execute commands.

What You’ll Need

  • Ubuntu 24.04 server with root or sudo privileges
  • Domain name pointing to your server (optional but recommended)
  • Basic familiarity with terminal commands and server management
  • Node.js (version 14 or higher) installed
  • Docker and Docker Compose installed (recommended for simplicity)
  • PostgreSQL database (if not using Docker for database)

Step-by-Step

  1. Update Your System
  2. sudo apt update && sudo apt upgrade -y
  3. Install Dependencies
  4. sudo apt install -y curl gnupg software-properties-common
  5. Install Node.js
  6. curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
    sudo apt install -y nodejs
  7. Install Docker and Docker Compose
  8. sudo apt install -y docker.io
    sudo systemctl enable --now docker
    sudo usermod -aG docker $USER
    
    # Log out and back in, then verify
    docker --version
    sudo apt install -y docker-compose
  9. Set Up PostgreSQL Database
  10. sudo apt install -y postgresql postgresql-contrib
    sudo -u postgres createuser -s umami
    sudo -u postgres createdb umami
  11. Download Umami Server Files
  12. git clone https://github.com/umami-software/umami.git
    cd umami
  13. Configure Environment Variables
  14. cp .env.example .env
    # Edit .env to set your database credentials and hostname
    nano .env
  15. Build and Run Umami with Docker
  16. docker-compose up -d --build
  17. Access the Web Interface
  18. Once the containers are running, open your browser and navigate to http://your-server-ip:3000. You should see the Umami setup page. Complete the setup by creating an admin user and configuring your website tracking.

Common Mistakes

  • Not updating system packages before starting installation, leading to dependency issues.
  • Forgetting to set environment variables correctly in the .env file, which causes database connection failures.
  • Running Docker commands without sufficient permissions—ensure your user is added to the docker group or run with sudo.
  • Overlooking firewall settings—make sure port 3000 (or your custom port) is open in your server’s firewall.
  • Not mapping environment variables properly, resulting in misconfigured database or server settings.

Tips

  • Use a domain name with SSL certificates (via Let’s Encrypt) for secure access to your analytics dashboard.
  • Regularly back up your PostgreSQL database containing your analytics data.
  • Customize your .env file to specify your preferred port, database credentials, and other settings.
  • Monitor Docker container logs using docker-compose logs for troubleshooting.
  • Consider setting up a reverse proxy (like Nginx) for easier access and SSL termination.

Troubleshooting

If you encounter issues during installation or operation, follow these steps:

  • Docker Containers Not Starting: Check logs with docker-compose logs. Ensure all environment variables are correctly set and ports are free.
  • Cannot Access Web Interface: Verify that your server’s firewall allows incoming traffic on the port you’re using. Test connectivity with curl.
  • Database Connection Errors: Double-check database credentials in .env. Ensure PostgreSQL service is running.
  • Performance Issues: Monitor server resources. Consider allocating more CPU/memory or optimizing Docker configurations.
  • SSL or Domain Issues: Confirm DNS records are correct and SSL certificates are properly installed if using HTTPS.

Frequently Asked Questions

1. Can I install Umami without Docker?

Yes, but using Docker simplifies setup and management. Installing manually involves setting up Node.js, PostgreSQL, and configuring services individually.

2. Is Umami suitable for high-traffic websites?

Umami is designed for lightweight analytics, making it suitable for most websites, but for extremely high traffic, consider scaling your database or infrastructure accordingly.

3. How do I track multiple websites with Umami?

Register each website in the Umami dashboard and embed the tracking script on each site with its unique identifier.

4. Can I customize the tracking script?

Yes, you can modify the script to suit your needs, but it’s recommended to use the default snippet for compatibility and security.

5. How do I update Umami to the latest version?

Pull the latest code from the repository, rebuild your Docker containers, and restart them to apply updates.

6. Is my data private with Umami?

Absolutely. Unlike third-party analytics, your data stays on your server, giving you full control and privacy.

Related

How to Install Umami Analytics on Ubuntu 24.04
Scroll to top