Uptime Kuma is a self-hosted, open-source monitoring tool that helps you keep track of the uptime and status of your websites, servers, and applications. It provides real-time status updates, notifications, and detailed reports on the availability and performance of your monitored services. Uptime Kuma is designed to be a modern and flexible alternative to other uptime monitoring solutions.
This guide will walk you through the process of installing Uptime Kuma on an Ubuntu 22.04 system.
Step 1 – Install Node.js
Uptime Kuma requires Node.js to run. First, add the NodeSource repository and install Node.js:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
apt-get install -y nodejs
Verify the installation by checking the Node.js version:
node -v
Step 2 – Install and Setup Uptime Kuma
First, clone the Uptime Kuma repository from GitHub.
git clone https://github.com/louislam/uptime-kuma.git
Navigate to the uptime-kuma directory and run the setup script using npm:
cd uptime-kuma
npm run setup
Step 3 – Install PM2 for Process Management
PM2 is a process manager for Node.js applications that allows you to keep your app running in the background and restart it if it crashes. Install PM2 globally:
npm install pm2 -g
Install the PM2 log rotation module to manage log files efficiently:
pm2 install pm2-logrotate
You should see output similar to this:
┌────┬──────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
└────┴──────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module │ version │ pid │ status │ ↺ │ cpu │ mem │ user │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0 │ pm2-logrotate │ 2.7.0 │ 87179 │ online │ 0 │ 0% │ 11.0mb │ root │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘
Step 4 – Start Uptime Kuma with PM2
Start the Uptime Kuma server using PM2:
pm2 start server/server.js --name uptime-kuma
You should see output similar to this:
[PM2] Starting /root/uptime-kuma/server/server.js in fork_mode (1 instance)
[PM2] Done.
┌────┬──────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼──────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ uptime-kuma │ default │ 1.23.13 │ fork │ 87203 │ 0s │ 0 │ online │ 0% │ 5.7mb │ root │ disabled │
└────┴──────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module │ version │ pid │ status │ ↺ │ cpu │ mem │ user │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0 │ pm2-logrotate │ 2.7.0 │ 87179 │ online │ 0 │ 0% │ 52.3mb │ root │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘
Check the status of the process to ensure it’s running correctly:
pm2 status
To ensure Uptime Kuma starts on system boot, configure PM2 with the following command:
pm2 startup
Step 5 – Install and Configure Nginx
To make Uptime Kuma accessible via a web domain, we will use Nginx as a reverse proxy. First, install Nginx:
apt install nginx -y
Create a new Nginx configuration file for Uptime Kuma:
nano /etc/nginx/conf.d/kuma.conf
Add the following configuration to the file:
server {
listen 80;
server_name kuma.example.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;
}
}
Test the Nginx configuration for syntax errors:
nginx -t
You should see the following output if the configuration is correct:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart Nginx to apply the changes:
systemctl restart nginx
Step 6 – Access Uptime Kuma
You can now access your Uptime Kuma instance through your web browser by navigating to http://kuma.example.com. You will see the account creation page.
Define your admin username, password and click on Create. You will see the Uptime Kuma dashboard.
Conclusion
Congratulations! You have successfully installed and configured Uptime Kuma on Ubuntu 22.04. Uptime Kuma is now running behind Nginx and can be accessed via your configured domain. This setup ensures that your monitoring tool is robust, easy to manage, and ready to alert you in case of any issues with your websites or servers. You can now monitor your application using Uptime Kuma on dedicated server hosting from Atlantic.Net!