Steps to install Uptime Kuma open source monitoring solution on Ubuntu 22.04 LTS Jammy JellyFish without Docker to keep eye on your Server.
Kuma is a very lean monitoring tool for your environment and many more. ICMP (ping) requests can be sent super easily or simply check whether a website is accessible. Even open TCP ports can be included super easily in the monitoring. It is a self-hosted monitoring tool like “Uptime Robot”.
Here are its important features of it:
• Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / Ping / DNS Record / Push / Steam Game Server.
• Fancy, Reactive, Fast UI/UX.
• Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and 90+ notification service.
• 20-second intervals.
• Multi-Languages
• Multiple Status Pages
• Map Status Page to Domain
• Ping Chart
• Certificate Info
• Proxy Support
• 2FA available
Steps to install Kuma on Ubuntu 22.04 Linux
The commands given here to install Kuma can be used by other versions of Ubuntu servers or desktops such as 20.04 or 18.04 including Debian.
1. Update your Ubuntu 22.04
If you have not updated your Ubuntu 22.04 LTS Jammy for a while then first run the given command to make sure all the packages on your system are in their latest.
sudo apt update && sudo apt upgrade
2. Install Nodejs and NPM
The long-term stable version of Nodejs is already available to install using the APT package manager of our Ubuntu 22.04 system. However, the version we get will be the Nodejs v12 (quite old) and to install Uptime Kuma we need at least version 14. Therefore, manually, add the repository of Nodejs to get its current version.
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
3. Install Uptime Kuma on Ubuntu 22.04
Kuma is not available to install using the default system repository of Ubuntu, hence we have to clone it from the GitHub page where the project is located.
Install Git:
sudo apt install git
Clone Uptime Kuma project
git clone https://github.com/louislam/uptime-kuma.git
Switch to clone Kuma directory:
cd uptime-kuma
Now, run its installation setup using the NPM package manager of Nodejs.
npm run setup
4. Start Uptime Kumar with Pm2
PM2 is a Production Process Manager for Node.js applications with a built-in Load Balancer. The key reason for installing and using Pm2, here, is it can manage and keep the Nodejs installed application running in the background. Hence, the command line of Nodejs will be free to work on other applications. It also allows monitoring of the status of the installed applications.
Install Pm2
sudo npm install pm2 -g && pm2 install pm2-logrotate
Run the Uptime Kumar server in the background using PM2
Start Server
pm2 start server/server.js --name uptime-kuma
After starting the server, let’s create a service file for PM2 so that it can start automatically the Kuma with our system boot.
pm2 startup
The above command checks the type of init system and provides you a command to create the pm2 service unit. Copy the script command given by the PM2 and run it on your system. To get an idea, refer to the given screenshot:
5. Setup Proxy server on Ubuntu 22.04 (optional)
We can access the web interface of Uptime Kuma by opening the browser on our local system where we have installed it. By pointing it to server-IP-address and using port number 3001 because by default Kuma runs on this port.
http://server-ip-address:3001
However, if you want to use the reverse proxy server then here are the commands to do that.
For Nginx
Those who want to use Nginx can go for the following commands:
Create Nginx server block or virtual host file for Kuma:
sudo nano /etc/nginx/sites-available/kuma
Now, add the following lines:
server {
listen 80;
server_name sub.domain.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;
}
}
Note: If you are planning to use a domain then don’t forget to replace sub.domain.com with the one you want to use.
Save the file by pressing Ctrl+O, then Enter Key and finally exit the file using Ctrl+X.
After that enabling the created configuration file, remove the default one:
sudo ln -s /etc/nginx/sites-available/kuma /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
Restart Nginx:
sudo service nginx restart
———————————————————————————————
For Apache
Install Apache webserver
sudo apt install apache2
Enable a few required modules:
sudo a2enmod ssl proxy proxy_ajp proxy_wstunnel proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
Restart apache:
sudo systemctl restart apache2
Create a Virtual host configuration file for Kuma:
sudo nano /etc/apache2/sites-available/kuma.conf
Paste the following lines:
<VirtualHost *:80>
ServerName sub.domain.com
ProxyPass / http://localhost:3001/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:3001/$1" [P,L]
</VirtualHost>
Note: If you are planning to use a domain then don’t forget to replace sub.domain.com with the one you want to use.
Disable default Apache configuration:
sudo a2dissite 000-default.conf
Enable the one you have created for Kuma:
sudo a2ensite kuma.conf
Reload Apache
sudo systemctl reload apache2
For other webservers to set up as a reverse proxy server, users can see the Github dedicated for that.
6. Uptime Kumar Web interface
After using Nginx or Apache as a proxy server, you will be able to access the web interface of Kuma to set it up.
7. Let’s Encrypt SSL certificate
Those who are not using some third-party SSL provider or DNS manager such as Cloudflare can directly generate the SSL certificate free of cost using the Let’s Encrypt for the domain used for Uptime Kuma running on Ubuntu 22.04. Here is the command to follow:
sudo apt install certbot
For Nginx:
sudo apt-get install python-certbot-nginx
sudo certbot --nginx -d yourdomain.com
For Apache:
sudo apt install python3-certbot-apache
sudo certbot --apache -d yourdomain.com
Note: Replace yourdomain.com with the one you have.
Other Articles:
Install Google Cloud SQL Proxy on Ubuntu 22.04 | 20.04
3 ways to install Nodejs & NPM on Ubuntu 22.04 LTS Jammy
How to Install Checkmk on Ubuntu 22.04 LTS Jammy…
How to install MediaWiki on Ubuntu 22.04
How to install ownCloud on Ubuntu 22.04
The service stops when I log off the machine, how can I stop this?