Skip to content
Home ยป How to Install Uptime Kuma on Linux?

How to Install Uptime Kuma on Linux?

  • by

Uptime Kuma is a self-hosted monitoring solution created to measure the uptime and performance of websites and services. It offers live status updates, flexible alerting choices, and comprehensive metrics to help guarantee that your websites and services stay functional.

 

Problem

How to install Uptime Kuma on Linux?

 

Solution

There are 4 methods to install uptime kuma:

  1. Using docker.
  2. Using docker compose with database in docker.
  3. Using docker compose with database in the host.
  4. Using package.

This article will explain how to install Kuma using Docker.

1. Install uptime kuma

Make sure you installed Docker in your server and you can see how to install Docker on this page. After that, run the command below to install uptime kuma using docker:

docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1 

 

Then check whether the uptime kuma container is running or not using the command:

docker ps | grep Kuma
Check the uptime kuma container in Docker

 

2. Configure webserver

If you use Apache, create a file at /etc/apache2/sites-available/kuma.conf and copy the script below to the file:

<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/

ProxyPass / http://localhost:3001/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:3001/$1" [P,L]

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

 

then run the command below:

sudo a2enmod rewrite
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2ensite kuma.conf

 

Check if there is an error in apache and if there is no error, reload apache using the command below:

apachectl -t
sudo systemctl reload apache2

 

INFO
If your server is running an nginx webserver, then in the file /etc/nginx/conf.d/uptime-kuma.conf insert the script below:

server {
    listen 80;
    server_name uptime-kuma.yourdomainname.com;

    location / {
        proxy_pass         http://localhost:3001;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection "upgrade";
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;

        # Added WebSocket support
        proxy_set_header   Sec-WebSocket-Key $http_sec_websocket_key;
        proxy_set_header   Sec-WebSocket-Version $http_sec_websocket_version;
        proxy_set_header   Sec-WebSocket-Extensions $http_sec_websocket_extensions;

        # Improve performance of this reverse proxy
        proxy_buffering    off;
    }

    # Redirect HTTP to HTTPS if needed for encryption
    # Uncomment the following lines if you have SSL enabled
    # return 301 https://$host$request_uri;
}

 

Use the command below to check if there is an error in the nginx configuration and then reload nginx:

nginx -t
sudo systemctl reload nginx

 

3. Configure database

If you install uptime kuma using docker, you don’t need to install the database because in the docker there is already a SQLite database where you can view it by using the command below:

docker exec -it uptime-kuma ls /app/data
Check the database in the uptime kuma container

 

4. Access uptime kuma

Open your browser, and type:

http://ip_server:3001

 

then there will be a display like below:

Create username and password for Uptime Kuma

 

Enter the username and password you want then press the Create button, there will be a display as below:

Display of uptime kema application

 

If you want to monitor a host or a website, click the Add New Monitor button like in the below image:

Create a new host or a website to monitor in uptime kuma

 

Fill in the required fields (at least fill in the Monitor Type, Friendly Name, and URL columns) and press the Save button, then the host you have filled in will look like in the image below:

Monitor the host or the website

 

If you just want to display the status without displaying many attributes then you can click the Status Pages button at the top right of the layer then there will be a display like below:

Click the New Status Page button

 

Click the New Status page button, then there will be a display as below:

Create the Status Page page

 

Enter the name and slug you want (I wrote the sites for the name and slug), then press the Next button, then there will be a display as below:

Insert the host or the monitor in the Status Page

 

Enter the host you want to display on the Status Page, after that click the Save button, then there will be a display as below:

Display of Status Page

 

You can see that the hosts to be monitored look simpler and you can give the URL to other parties to also monitor these hosts.

 

Note

If you want to backup the uptime kuma database running on docker and how to restore the database, you can go to this page.

 

References

uptimekuma.org
kb.biznetgio.com

image_pdfimage_print
Visited 2 times, 1 visit(s) today

Leave a Reply

Your email address will not be published. Required fields are marked *