Setup new Uptime Kuma on Ubuntu VM

Modified on Thu, 29 Jan at 4:01 PM

On a Ubuntu VM:

sudo -i
apt-get install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update && apt upgrade -y
apt install docker.io -y
systemctl enable docker
systemctl start docker
apt install docker-compose-plugin
exit
mkdir uptime-kuma
cd uptime-kuma
curl -o compose.yaml https://raw.githubusercontent.com/louislam/uptime-kuma/master/compose.yaml
sudo docker compose up -d



# to stop the container:
docker stop uptime-kuma-uptime-kuma-1

# then restore the files with winscp


# start the container again
docker start uptime-kuma-uptime-kuma-1



# monitor log
docker logs uptime-kuma-uptime-kuma-1

And to update:

sudo -i
cd uptime-kuma
docker compose pull
docker compose up -d --force-recreate


To insert new monitors directly into the SQLite database, SSH to the server and then:

sudo -i
cd uptime-kuma/
docker exec -it uptime-kuma-uptime-kuma-1 sqlite3 /app/data/kuma.db

And then use this to insert:

BEGIN TRANSACTION; INSERT INTO monitor (name, hostname, type, user_id, active, interval, maxretries, retry_interval, conditions, parent) VALUES ('DISPLAY_NAME', 'IP_OR_HOSTNAME','ping', 1, 1, 20, 0, 20, '[]', PARENT_ID); INSERT INTO monitor_notification (monitor_id, notification_id) VALUES (last_insert_rowid(), 1); COMMIT;

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article