Install Uptime Kuma on Ubuntu 20.04

Install Uptime Kuma on Ubuntu 20.04

Uptime Kuma is an open-source tool to monitor the uptime of hosts or servers. This tool can be used to check if website or service is up. If monitored target is not reachable for specified time interval, then notifications can be send via Slack, Telegram, Discord, or other notification service. Uptime Kuma provides dashboard that can be accessed via a web browser.

This tutorial shows how to install Uptime Kuma on Ubuntu 20.04.

Prepare environment

Uptime Kuma requires Node.js runtime environment and npm. You can install them by reading post. You also need to have Git. You can read post how to install it.

Install Uptime Kuma

Clone the Uptime Kuma repository from GitHub:

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

Go to Uptime Kuma directory:

cd /opt/uptime-kuma

Install all necessary packages and build web assets:

sudo npm run setup

Run Uptime Kuma as a service

We can configure systemd in order to run Uptime Kuma as a service. Create a systemd unit file:

sudo nano /etc/systemd/system/uptime-kuma.service

Add the following content:

[Unit]
Description=Uptime Kuma - uptime monitoring tool
After=network.target

[Service]
WorkingDirectory=/opt/uptime-kuma
ExecStart=/usr/bin/node server/server.js
Restart=always

[Install]
WantedBy=multi-user.target

Start Uptime Kuma service:

sudo service uptime-kuma start

You can use the following command to check if service is running:

sudo service uptime-kuma status

Also you can stop or restart the service:

sudo service uptime-kuma stop
sudo service uptime-kuma restart

To enable Uptime Kuma to start on boot, run the following command:

sudo systemctl enable uptime-kuma

Testing Uptime Kuma

Open a web browser and go to http://<IP_ADDRESS>:3001, where <IP_ADDRESS> is IP address of the system.

For the first time you will be needed to create the administrator account of Uptime Kuma. After that, you will be redirected to dashboard.

Uptime Kuma dashboard on Ubuntu

Uninstall Uptime Kuma

If you want to completely remove the Uptime Kuma, stop the service and remove a systemd unit file.

sudo service uptime-kuma stop
sudo systemctl disable uptime-kuma
sudo rm -rf /etc/systemd/system/uptime-kuma.service
sudo systemctl daemon-reload
sudo systemctl reset-failed

Delete the installation directory:

sudo rm -rf /opt/uptime-kuma

Leave a Comment

Cancel reply

Your email address will not be published.