Skip to content
Home » How to Install Uptime Kuma Application on Ubuntu?

How to Install Uptime Kuma Application on Ubuntu?

  • by

The previous articles explained how to install the uptime kuma application on Docker, either using the SQLite database or using the MariaDB database on Docker or using the MariaDB database on the host. This article will explain how to install the uptime kuma application without using Docker but using packages. 

 

Problem

How to install uptime kuma application on Ubuntu?

 

Solution

Here are the steps to install uptime kuma application on Ubuntu:

1. Install the packages

Run the commands below to install the required packages:

sudo apt update -y
sudo apt install nginx mariadb-server git -y

 

Then, install nodejs using the command below:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt install -y nodejs

 

After that, download the uptime kuma application by running the command below:

git clone https://github.com/louislam/uptime-kuma.git
cd uptime-kuma/

 

Next, copy the commands below to install the uptime kuma application:

sudo npm run setup
sudo npm install pm2 -g 
sudo pm2 install pm2-logrotate
sudo pm2 start server/server.js --name uptime-kuma
sudo pm2 startup

 

2. Configure MariaDB

Access MariaDB and run the queries below:

Akses ke MariaDB dan jalankan query-query di Bawah ini:
CREATE DATABASE uptime_kuma; 
CREATE USER 'kuma-user'@'%' IDENTIFIED BY 'kumapass123'; 
GRANT ALL PRIVILEGES ON uptime_kuma.* TO 'kuma-user'@'%'; 
FLUSH PRIVILEGES; 
\q

 

3. Configure web server

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:

sudo nginx -t
sudo systemctl reload nginx

 

4. Access uptime kuma

Open your browser, and type:

http://ip_server:3001

 

then there will be a display like below:

Click the MariaDB/MySQL button

 

Click MariaDB/MySQL, your screen will appear similar to the picture below:

Fill in the columns for the database

 

Enter in the columns above the values ​​that correspond to the query commands. Click the Next button, your screen will show up similar to the one below:

Setting up the database

 

You have to wait until finish, and after that, your screen will appear similar to the image shown below:

Fill in the columns for the admin account

 

Enter in the columns above the value you want and press the Create button then a display will appear similar to the image provided below:

Display of uptime kuma application

 

If you want to monitor the website, click the Add New Monitor button at the top left of the site , an image similar to the one shown will appear:

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

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 site like the image below:

Click the Status Pages button

 

After you press the Status Pages button, the following image will appear: 

Create the Status Page page

 

Click the New Status Page button, and an image will appear similar to the one shown 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 check the status of uptime kuma in the server, run the command below :

sudo pm2 status server/server.js --name uptime-kuma
Check the status of uptime kuma

 

But if you want stop uptime kuma in the server, run the command below :

sudo pm2 stop server/server.js --name uptime-kuma
Stop status kuma service

 

References

uptimekuma.org
hostmycode.in
youtube.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 *