Linux is the preferred choice of OS when it comes for servers. It is stable, has plenty of support and does not use much resources. In this Uptime Kuma installation guide, we will be using Ubuntu as our base Linux distribution.
Follow the steps below in order to Install Uptime Kuma on Ubuntu or any other Debian-based Linux distribution.
Requirements
Downloading Uptime Kuma for Linux
Once you have made sure that the above software mentioned under “Requirements” are met, please go to Uptimekuma.org and click on the “Download” button at the center of the page or at the top-right of the page. Alternatively, you can also visit that page from here.
Install Uptime Kuma on Ubuntu with Node.js and Nginx
One of the first steps is to install Node.js on Ubuntu but before you do so make sure your server is updated. Please run the x2 commands below before following the tutorial.
sudo apt update
sudo apt upgrade -y
Once your OS is updated, you can run the below command to install Node.js:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt install -y nodejs
Once Node.js is installed, you will need to clone the Git Repo of Uptime Kuma, however before doing that make sure you have Git installed with the below command:
sudo apt update && sudo apt install -y git
To clone the Uptime Kuma GitHub repository locally, please run the below command in your terminal which will clone the latest release:
git clone https://github.com/louislam/uptime-kuma.git
Make a note of the directory where you cloned the repository e.g. /home and navigate to it.
cd /home/uptime-kuma
Once you are in the relevant directory you need to run the setup script along with the PM2 process manager which will keep Uptime Kuma running:
npm run setup
npm install pm2 -g
We also recommend setting up log rotation with the below command as logs will help you troubleshoot if any issues arise:
pm2 install pm2-logrotate
Once you have the above setup, it is now time to start Uptime Kuma with a simple command below and to ensure that if you ever reboot your server, Uptime Kuma starts back automatically:
pm2 start server/server.js --name uptime-kuma
pm2 startup
To make sure Uptime Kuma can be accessed via the browser and a domain name, Nginx or Apache needs to be setup as a reverse proxy, in this case we will be using Nginx:
apt install nginx -y
Once Nginx has been installed, make sure it is installed and running the latest version with the below commands:
nginx -v
systemctl status nginx
Now you have to create a Nginx configuration file, also known as a “conf” file with the below contents that you can copy and paste, you can either use Vim or Nano editor:
vi /etc/nginx/conf.d/uptime-kuma.conf
Configuration file contents with improved security added along with performance enhancements, replace “uptime-kuma.yourdomainname.com” with your own domain name if you have one:
server {
listen 80;
server_name uptime-kuma.yourdomainname.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;
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;
# Added WebSocket support
proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;
proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;
# Improve performance of this reverse proxy
proxy_buffering off;
}
# Redirect HTTP to HTTPS if needed for encryption
# Uncomment the following lines if you have SSL enabled
# return 301 https://$host$request_uri;
}
Once you have saved the above configuration file, just restart Nginx and you will now have Uptime Kuma running on your Linux server:
systemctl restart nginx
You should be able to access the Uptime Kuma dashboard now at your domain name, our example used in this guide was “uptime-kuma.yourdomainname.com”.
As always, you can refer to our detailed troubleshooting section for any questions or queries you may have.