How to Install Uptime Kuma on Ubuntu 24.04: A Complete Step-by-Step Tutorial
Introduction
Uptime Kuma has emerged as a popular open-source monitoring tool that allows you to keep track of server health, website uptime, and more. In this tutorial, you’ll learn how to install and configure Uptime Kuma on a fresh Ubuntu 24.04 system. From updating your server to setting up PM2 for process management, we’ve got you covered every step of the way.
What Is Uptime Kuma?
Uptime Kuma is a self-hosted monitoring service that provides real-time stats on the availability of your services and websites. It offers a sleek dashboard, customizable checks, and even notifications via various channels. Its ease of installation and use makes it a favorite among DevOps professionals and hobbyists.
Prerequisites
- A fresh Ubuntu 24.04 server (e.g., a minimal installation)
- SSH access to the server (preferably as root or a user with sudo privileges)
- Basic command-line knowledge
Step 1: Update and Upgrade Your System
Keeping your server up to date ensures security and stability. Let’s start with that:
ssh root@YOUR_SERVER_IP
apt update
apt upgrade -y
Step 2: Install Node.js
Uptime Kuma requires Node.js (v14+). We’ll install Node.js 18 (LTS):
apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
Verify the installation:
node -v
npm -v
Step 3: Clone the Uptime Kuma Repository
Next, navigate to /opt
and clone the GitHub repository:
apt install -y git
cd /opt
git clone https://github.com/louislam/uptime-kuma.git
Step 4: Install Dependencies and Build Uptime Kuma
Let’s install the necessary production dependencies and then build the front-end:
cd /opt/uptime-kuma
npm install --production
npm run setup
Note: If you encounter any Git checkout issues, discard local changes using git restore -- package-lock.json
or stash them with git stash
.
Step 5: Configure UFW (Optional)
If you have UFW enabled (Ubuntu’s Uncomplicated Firewall), open port 3001 (the default Uptime Kuma port):
ufw allow 3001/tcp
Step 6: Start Uptime Kuma
Option A: Run in Foreground
For a quick test, you can run Uptime Kuma in the foreground:
node server/server.js
- Access Uptime Kuma via: http://YOUR_SERVER_IP:3001
- Press
Ctrl + C
to stop the service.
Option B: Run as a Service with PM2
For a production environment, it’s recommended to use PM2:
- Install PM2:
npm install pm2@latest -g
- Start Uptime Kuma:
pm2 start server/server.js --name uptime-kuma
- Enable PM2 Startup:
pm2 startup systemd
# Follow the instructions that appear, then:
pm2 save
With PM2, Uptime Kuma will automatically run after system reboots.
Set Up a Reverse Proxy (Optional)
If you want to serve Uptime Kuma over standard HTTP/HTTPS ports, set up an Nginx reverse proxy.
- Install Nginx:
apt install -y nginx
- Create a Server Block (e.g.,
/etc/nginx/sites-available/uptime-kuma.conf
):
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3001;
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;
}
}
- Enable and Reload:
ln -s /etc/nginx/sites-available/uptime-kuma.conf /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx
Conclusion
Installing Uptime Kuma on Ubuntu 24.04 is straightforward once you have Node.js and the necessary dependencies in place. With PM2, you can run Uptime Kuma reliably, and adding an Nginx reverse proxy provides secure and accessible monitoring. Start exploring your new uptime monitoring dashboard and keep your services in top shape!