umami
reference: https://umami.is/docs/install
separate umami user¶
setup node enviroment¶
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16631 100 16631 0 0 65228 0 --:--:-- --:--:-- --:--:-- 65476
=> Downloading nvm from git to '/home/umami/.nvm'
=> Cloning into '/home/umami/.nvm'...
remote: Enumerating objects: 382, done.
remote: Counting objects: 100% (382/382), done.
remote: Compressing objects: 100% (325/325), done.
remote: Total 382 (delta 43), reused 179 (delta 29), pack-reused 0 (from 0)
Receiving objects: 100% (382/382), 385.06 KiB | 13.75 MiB/s, done.
Resolving deltas: 100% (43/43), done.
* (HEAD detached at FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> Appending nvm source string to /home/umami/.bashrc
=> Appending bash_completion source string to /home/umami/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
$ nvm install --lts
Installing latest LTS version.
Downloading and installing node v22.16.0...
Downloading https://nodejs.org/dist/v22.16.0/node-v22.16.0-linux-x64.tar.xz...
######################################################################################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v22.16.0 (npm v10.9.2)
Creating default alias: default -> lts/* (-> v22.16.0)
umami@v2202403219424260640:~$ node --version
v22.16.0
umami@v2202403219424260640:~$ npm --version
10.9.2
# In your case it might be sudo apt install mysql-server
sudo apt install default-mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE umami;
CREATE USER 'umami'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON umami.* TO 'umami'@'localhost';
FLUSH PRIVILEGES;
EXIT;
The build failed for me, the error and solution were mentioned here: https://github.com/umami-software/umami/issues/2693
/etc/systemd/system/umami.service
[Unit]
Description=Umami Analytics
After=network.target
[Service]
User=umami
WorkingDirectory=/home/umami/umami
Environment=NVM_DIR=/home/umami/.nvm
Environment=PATH=/home/umami/.nvm/versions/node/v22.16.0/bin:/usr/local/bin:/usr/bin:/bin
ExecStart=/home/umami/.nvm/versions/node/v22.16.0/bin/yarn start
Restart=always
[Install]
WantedBy=multi-user.target
Setting up nginx¶
Before getting certs, set up a simple site conf:
/etc/nginx/sites-available/umami
server {
listen 80;
server_name example.com;
root /var/www/html;
index index.html;
}
Now get https certs:
This generates cert files. Now you can update the nginx site conf:
/etc/nginx/sites-available-umami
server {
listen 443 http2;
listen [::]:443 http2;
server_name umami.vectorspace.xyz;
ssl on;
ssl_certificate /etc/letsencrypt/live/umami.vectorspace.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/umami.vectorspace.xyz/privkey.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
listen [::]:80;
server_name umami.vectorspace.xyz;
return 301 https://umami.vectorspace.xyz$request_uri;
access_log /dev/null;
error_log /dev/null;
}
~
log in into self hosted umami¶
Note
- default username: admin
- default password: umami
First thing to do is change the default password. You can do that by clicking on your profile icon. Add your website.
Find the tracking code after logging into your self hosted umami:
Configuring mkdocs¶
overrides/partials/integrations/analytics/custom.html
<script defer src="..." data-website-id=".."></script>