Tutorial: How to Install Umami on Debian Latest

Umami is a modern open-source web analytics platform for self-hosted websites. It provides essential insights without compromising the privacy of your users. In this tutorial, we will guide you through the process of installing Umami on Debian Latest.

Prerequisites

Before we begin, you should ensure that you have the following:

  • A Debian Latest server with root access.
  • A domain name pointing to the server IP address.
  • A working web server such as Nginx or Apache.
  • A MySQL or PostgreSQL database server.

Step 1: Install Node.js and NPM

Umami is built using Node.js, so you need to install it first. You can do this by running the following commands:

sudo apt update
sudo apt install nodejs npm -y

Once Node.js and NPM are installed, you can check their version by running:

node -v
npm -v

Step 2: Install Umami

To install Umami, you need to clone the Umami repository from Github. You can do this by running:

git clone https://github.com/mikecao/umami.git

Next, navigate to the cloned directory:

cd umami

Then, install the required dependencies by running:

npm install

Step 3: Configure Umami

Before you can use Umami, you need to configure it. You can do this by copying the example configuration file and customize it. You can do this by running:

cp .env.example .env

Next, edit the .env file and set the following variables:

  • DATABASE_URL: The URL of your PostgreSQL or MySQL database server.
  • DOMAIN: The domain name of your Umami installation.
  • ADMIN_EMAIL: The email address of the Umami administrator.
  • ADMIN_PASSWORD: The password of the Umami administrator.

Step 4: Create the Umami Database

To create the Umami database, you can use the umami-cli command-line tool. You can install it by running:

npm install -g umami-cli

Then, create the Umami database by running:

umami-cli migrate

You should see the following output:

✔ Migration complete

Step 5: Launch Umami

To launch Umami, you can use the npm start command. You can do this by running:

npm start

Now, you can visit http://your-domain.com:3000 in your web browser, and you should see the Umami login screen. Log in using the email and password you defined in Step 3.

Step 6: Set up Nginx Reverse Proxy

By default, Umami listens on port 3000. If you want to expose it to the internet, you can set up an Nginx reverse proxy. You can do this by creating an Nginx configuration file at /etc/nginx/sites-available/your-domain.com with the following content:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Then, enable the configuration file by running:

sudo ln -s /etc/nginx/sites-available/your-domain.com /etc/nginx/sites-enabled/
sudo service nginx reload

Now, you should be able to access Umami at http://your-domain.com in your web browser.

Conclusion

Congratulations! You have successfully installed Umami on Debian Latest. Umami is an excellent alternative to commercial web analytics platforms that respects the privacy of your users while providing essential insights. If you have any questions or comments, feel free to reach out to us.