How to install Uptime Kuma on Debian Latest

Uptime Kuma is a modern uptime monitoring software that provides an easy-to-use web interface to monitor, analyze, and troubleshoot server or website uptime issues. In this tutorial, we will explain how to install Uptime Kuma on Debian Latest.

Prerequisites

Before installing Uptime Kuma, make sure that the following prerequisites are met on your Debian server:

Step 1: Update the package repository

Let's start by updating the package repository on Debian server using the following command:

sudo apt update

Step 2: Install Git

Uptime Kuma is hosted on Github, so we need to install Git to download the source code from the Github repository. Run the following command to install Git on your Debian system:

sudo apt install git

Step 3: Download Uptime Kuma source code

We are now ready to download the Uptime Kuma source code from the Github repository. Change to the directory where you want to clone the source code and run the following command:

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

Step 4: Install PHP dependencies

Uptime Kuma uses various PHP packages that need to be installed before installation. Run the following command to install the necessary PHP packages:

sudo apt install php php-fpm php-mysql php-xml php-mbstring php-curl php-zip

Step 5: Install Composer

Uptime Kuma also uses Composer, a PHP dependency manager, to install and manage PHP packages. Use the following command to install Composer on your Debian system:

sudo apt install composer

Step 6: Install Node.js

Uptime Kuma also requires Node.js and NPM (Node Package Manager) to compile frontend assets. Use the following command to install the latest version of Node.js and NPM:

curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Step 7: Create MySQL database

Uptime Kuma uses MySQL or MariaDB as a database backend. We need to create a new database and a user with full privileges. Run the following commands to create a new database and user:

sudo mysql -u root -p
CREATE DATABASE uptimekuma;
CREATE USER 'uptimekuma'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON uptimekuma.* TO 'uptimekuma'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace password with a strong password for the new user.

Step 8: Configure Uptime Kuma

Copy the configuration file and update the MySQL database details:

cd uptime-kuma
cp .env.example .env

Use the following command to open and edit the configuration file:

nano .env

Set the following values in the .env file:

APP_URL=http://localhost
DB_DATABASE=uptimekuma
DB_USERNAME=uptimekuma
DB_PASSWORD=password

Update the APP_URL field with your domain name or IP address.

Step 9: Install Uptime Kuma dependencies and compile assets

Run the following command to install Uptime Kuma dependencies and compile the frontend assets:

composer install
npm install
npm run prod

Step 10: Configure Nginx

We need to create a new Nginx virtual host configuration file for Uptime Kuma. Use the following command to create a new file and open it using the nano editor:

sudo nano /etc/nginx/sites-available/uptimekuma.conf

Paste the following configuration into the file:

server {
    listen 80;

    server_name example.com; # Replace example.com with your domain name

    root /path/to/uptime-kuma/public;

    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Update FastCGI socket path if necessary
    }

    location ~ /\.ht {
        deny all;
    }

    client_max_body_size 50M;
    access_log /var/log/nginx/uptimekuma.access.log;
    error_log /var/log/nginx/uptimekuma.error.log;
}

Replace example.com with your domain name or IP address, and set the root path to the Uptime Kuma directory.

Save the file by pressing CTRL + X, then Y to confirm, and ENTER to exit the editor.

Create a symbolic link to enable the new virtual host configuration:

sudo ln -s /etc/nginx/sites-available/uptimekuma.conf /etc/nginx/sites-enabled/

Verify the Nginx configuration syntax:

sudo nginx -t

Then, restart the Nginx service:

sudo systemctl restart nginx

Step 11: Access Uptime Kuma

Open your browser and type http://example.com/ in the address bar (replace example.com with your domain name or IP address). You should see the Uptime Kuma login screen. Use the default email admin@admin.com and password admin to log in and change the credentials later.

Conclusion

In this tutorial, we have learned how to install Uptime Kuma on Debian Latest. Uptime Kuma is a powerful tool that can help you monitor your website uptime and debug any website downtime issues.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!