|

How to install Uptime Kuma on Ubuntu

Introduction

In today’s fast-paced digital landscape, ensuring the uninterrupted availability of online services and applications is crucial. Uptime Kuma, an open-source monitoring tool, plays a vital role in this endeavor by providing real-time insights into the health and performance of your systems. In this step-by-step guide, we will walk you through the process of installing Uptime Kuma on an Ubuntu server. By the end of this tutorial, you’ll have a powerful monitoring solution in place, allowing you to proactively identify and address issues, thus maintaining the reliability and uptime of your critical services.

Installation of Uptime Kuma and Configuration

Prerequisites

Before we dive into the installation, let’s ensure you have everything you need. To follow this guide, you’ll require an Ubuntu server, preferably running the latest LTS version. Additionally, make sure you have root access or a user with sudo privileges. Familiarity with basic command-line operations will also be beneficial.

Non-Docker Requirements:

  • Platform
    • ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
    • ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
    • ❌ Replit / Heroku
  • Node.js 14 / 16 / 18 / 20.4
  • npm >= 7
  • Git
  • pm2 – For running Uptime Kuma in the background

Installing Uptime Kuma

Update and Upgrade OS

sudo su
apt update && apt upgrade -y && apt autoremove -y
  1. sudo su:
    • The sudo command is used to execute commands with superuser or root privileges on Unix-like systems, including Ubuntu.
    • su stands for “switch user” or “substitute user.” When used together with sudo, it allows you to switch to the root user or another user with superuser privileges.
    In summary, sudo su is used to open a new shell session with root privileges. This can be useful when you need to execute multiple commands as the root user without constantly using sudo before each command.
  2. apt update && apt upgrade -y && apt autoremove -y:
    • apt is the Advanced Package Tool used in Debian-based Linux distributions, including Ubuntu, for managing software packages.update command is used to update the package list information on your system. It retrieves information about the latest versions of packages available in the repositories.upgrade -y is used to upgrade installed packages to their latest available versions. The -y flag is used to automatically answer “Yes” to any prompts that may come up during the upgrade process.autoremove -y is used to remove any automatically installed but no longer required packages. The -y flag, once again, answers “Yes” to any prompts that may appear during the removal process.
    In summary, this command sequence ensures that your system is up to date by updating package lists, upgrading installed packages, and removing any unnecessary packages to free up disk space. It’s a routine maintenance task to keep your system secure and efficient.

Installing Node.js, Git, and PM2

Uptime Kuma relies on Node.js for its functionality. Install Node.js, Git, and PM2 using the following commands:

curl -sL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh
bash /tmp/nodesource_setup.sh
apt install nodejs git-all -y
npm install npm -g
npm install pm2 -g
  1. Node.js:
    • Node.js is a JavaScript runtime environment that allows you to execute JavaScript code on the server-side. It is built on the V8 JavaScript engine, the same engine that powers the Google Chrome web browser.
    • Node.js is commonly used for building scalable and high-performance server-side applications. It’s particularly popular for developing web servers, APIs, and real-time applications.
    • Node.js comes with a package manager called npm (Node Package Manager) that makes it easy to install and manage JavaScript libraries and modules.
  2. Git:
    • Git is a distributed version control system used for tracking changes in source code during software development. It helps multiple developers collaborate on a project by allowing them to work on their own copies (branches) of a codebase and merge changes together.
    • Git is known for its speed and efficiency in managing large and small projects. It is widely used in the software development industry and is the foundation for many code hosting platforms like GitHub and GitLab.
  3. PM2 (Process Manager 2):
    • PM2 is a production process manager for Node.js applications. It is designed to keep Node.js applications running smoothly in production environments.
    • PM2 provides features such as automatic application restarts in case of crashes, load balancing for multiple application instances, logging, and process management. It can also be used to monitor and manage Node.js applications easily.
    • PM2 simplifies the deployment and management of Node.js applications, making them more reliable and easier to maintain in production settings.

In summary, Node.js is a JavaScript runtime for server-side development, Git is a version control system for tracking code changes, and PM2 is a process manager for Node.js applications used in production environments. These tools are often used together when developing and deploying web applications, especially those built using JavaScript and Node.js.

Setting Up Uptime Kuma

Cloning the Uptime Kuma Repository

Navigate to the /opt directory and clone the Uptime Kuma repository:

cd /opt
mkdir uptime-kuma
git clone https://github.com/louislam/uptime-kuma.git
cd uptime-kuma

Running Uptime Kuma Setup

Run the Uptime Kuma setup script:

npm run setup

Starting Uptime Kuma with PM2

Start the Uptime Kuma server with PM2, ensuring it runs continuously:

node server/server.js
pm2 start server/server.js --name uptime-kuma
pm2 startup

Configuring Uptime Kuma

Stop the Uptime Kuma process temporarily to configure it with custom settings:

pm2 stop uptime-kuma

Restart Uptime Kuma with Custom Port

Restart Uptime Kuma with your desired port configuration. For example, to run it on port 8888:

pm2 start server/server.js --name uptime-kuma -- --port=8888

Conclusion

In conclusion, you’ve successfully installed and configured Uptime Kuma on your Ubuntu server, equipping yourself with a valuable system monitoring tool. With its real-time insights and alerting capabilities, you’re now better prepared to maintain the reliability and uptime of your essential services. Explore Uptime Kuma’s features further to optimize your monitoring strategy and keep your systems running smoothly.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *