Product used: VPS 200 G10s iv
from 3.25€ / month | go to product >
This tutorial describes how to set up an Uptime Kuma instance on Ubuntu 20.04. Uptime Kuma is a free and open source uptime monitor. It is a self-hosted alternative to services like Uptime Robot or StatusCake. It is available as a Docker image, but this tutorial describes how to set up an instance without Docker (as a standalone).
This tool is very useful for getting notified when a service is down.
The time needed to follow this tutorial is approximately 10 - 20 minutes.
The tutorial was tested on Ubuntu 22.04 (April 2023).
The tutorial uses the example ip 123.123.123.123
.
This hostname needs to be replaced by the name of your own server when you perform the steps described below.
We will also use the domain example.com
in this tutorial. Replace it with your own domain.
We will not use the installation script provided by Uptime Kuma, because it is sometimes buggy.
For a 'small instance' (up to 20 monitored services) VPS 200 is sufficient.
I recommend setting up the instance on a VPS 200.
If you feel like the instance is slowing down, you can always update to a bigger server trough the CCP.
The server needs to have Ubuntu 20.04 and SSH already installed.
You will also need a domain. A domain used in a webhosting package is sufficient. (You can still use it for your webhosting, because we will use a subdomain.)
A
.First you need to log in to your server via SSH, then follow these steps:
sudo -s
to get root privileges.Enter
.apt update -y && apt upgrade -y
to update the server.Enter
once to continue.curl https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && bash /tmp/nodesource_setup.sh
to install NodeJS 16.apt install nodejs curl nginx git -y
to install all the required software.Enter
once to continue.npm install npm -g
to update npm.Enter
once to continue.npm install pm2 -g && pm2 completion install
to install pm2 and its autocompletion.exit
and press Enter
to leave root privileges.Enter the following command to install Uptime Kuma:
git clone https://github.com/louislam/uptime-kuma.git
to clone the repository.cd uptime-kuma
.npm run setup
to install all dependencies.npm run start-server
.Once you see "Listening on 3001" in the terminal, go to your IP on Port 3001 (e.g. 123.123.123.123:3001
) in your browser.
If you see the Uptime Kuma setup screen, you have successfully installed Uptime Kuma. Please stop the server by pressing Ctrl + C
in the terminal once. You have to wait a little while until the server stops.
sudo -s
to get root privileges.Enter
.nano /etc/nginx/sites-available/uptime-kuma
to create a new nginx config file.server {
listen 80;
## Remove '#' in the next line to enable IPv6
## 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;
}
}
sub.domain.com
with your subdomain (e.g. status.example.com
).Ctrl + X
and then Y
and then Enter
.ln -s /etc/nginx/sites-available/uptime-kuma /etc/nginx/sites-enabled/uptime-kuma
to enable the config file.nginx -t
to test the config file.test is successful
, you can reload nginx by entering systemctl reload nginx
.We want to start Uptime Kuma automatically when the server starts.
This is useful when the server reboots, as we cannot monitor the server running Kuma. When it is restarted, Kuma will also be restarted.
nano /etc/systemd/system/uptime-kuma.service
to create a new systemd service file.[Unit]
Description=Uptime-Kuma - A free and open source uptime monitoring solution
Documentation=https://github.com/louislam/uptime-kuma
After=network.target
[Service]
Type=simple
User=[REPLACE_WITH_USERNAME]
WorkingDirectory=/home/[REPLACE_WITH_USERNAME]/uptime-kuma
ExecStart=/usr/bin/npm run start-server
Restart=on-failure
[Install]
WantedBy=multi-user.target
[REPLACE_WITH_USERNAME]
with the user under which you want to run Uptime Kuma (we don't want to run it as root, so please run it as your SSH login user or create a new user).Ctrl + X
and then Y
and then Enter
.systemctl daemon-reload
to reload the systemd daemon.systemctl enable uptime-kuma
to enable the service.systemctl start uptime-kuma
to start the service.snap install --classic certbot
to install CertBot.certbot --nginx
to start the CertBot setup.Enter
to select the only option (your domain).We need a firewall to protect our server from unwanted connections.
We will use ufw
(Uncomplicated Firewall) to set up the firewall, because it is easy to use and configure and is also pre-installed on Ubuntu.
ufw allow ssh
to allow SSH connections.ufw allow http
to allow HTTP connections.ufw allow https
to allow HTTPS connections.ufw enable
to enable the firewall.Y
and then Enter
to confirm.https://status.example.com
).If this works, you should now restart the server and check if everything starts as it should. To do this, execute shutdown -r now
. After executing the command, you can close the SSH connection.
Now you have successfully installed Uptime Kuma and set it up to start on boot.
From now on your Kuma instance will be available under your subdomain (e.g. https://status.example.com
).
Thank you for using this tutorial!
Copyright (c) 2023 Konstantin Protzen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
By making a contribution to this project, I certify that:
The contribution was created in whole or in part by me and I have the right to submit it under the licence indicated in the file; or
The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate licence and I have the right under that licence to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different licence), as indicated in the file; or
The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the licence(s) involved.