How to Install Self Hosting n8n on Ubuntu 24.04 LTS (Step-by-Step Production Guide)

n8n non_logo

If you’re an IT Operations engineer or a Devops engineer, you know the value of self-hosting tools that empower automation without vendor lock-in. n8n is an open-source workflow automation platform that lets you connect apps, APIs, and services — similar to Zapier but fully under your control.

In this guide, you will learn how to install and run n8n on Ubuntu 24.04 LTS using Docker and set it up securely with automatic HTTPS — straight from the terminal.

Self-hosting n8n is ideal for organizations who want full control over their data, cost, and environment.

Prerequisites

Before starting, ensure you have:

  • An Ubuntu 24.04 LTS server instance with SSH access
  • A non-root sudo user
  • Basic familiarity with Linux terminal

Step 1 — Update Your Ubuntu Server

First, connect to your server over SSH and update the system packages to the latest versions:

sudo apt-get update
sudo apt-get upgrade -y

Keeping your OS updated reduces security risks and ensures all future installations go smoothly.

Step 2 — Install Docker & Docker Compose

Docker will handle the n8n container environment. Install it using the official Docker repository. The Docker installation has been discussed on How to Install Docker on Ubuntu 24.04 LTS (Step-by-Step Beginner Guide) article.

Step 3 — Deploy n8n with Docker Compose

Create a directory to hold your n8n config and compose file:

mkdir ~/n8n
cd ~/n8n

Create a docker-compose.yml:


sudo vi /etc/nginx/sites-available/n8n.dev01-bckinfo
yamlversion: '3.8'

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=pswd123
      - N8N_HOST=localhost
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=http://localhost:5678/
    volumes:
      - ./n8n-data:/home/ramansah/.n8n
    networks:
      - n8n-network

networks:
  n8n-network:
    driver: bridge

Start the n8n container:

docker compose up -d

This pulls the latest n8n image and runs it in detached mode.

ramansah@dev01-bckinfo:~/n8n$ docker compose up -d
[+] up 1/1
 ✔ Container n8n Created                                                                                                                                                               0.2s
ramansah@dev01-bckinfo:~/n8n$ docker ps
CONTAINER ID   IMAGE              COMMAND                  CREATED         STATUS         PORTS                                         NAMES
db61caadc613   n8nio/n8n:latest   "tini -- /docker-ent…"   9 seconds ago   Up 9 seconds   0.0.0.0:5678->5678/tcp, [::]:5678->5678/tcp   n8n
ramansah@dev01-bckinfo:~/n8n$ docker ps -a
CONTAINER ID   IMAGE              COMMAND                  CREATED          STATUS                  PORTS                                         NAMES
db61caadc613   n8nio/n8n:latest   "tini -- /docker-ent…"   16 seconds ago   Up 15 seconds           0.0.0.0:5678->5678/tcp, [::]:5678->5678/tcp   n8n
0ef2fcc6de30   hello-world        "/hello"                 3 days ago       Exited (0) 3 days ago                                                 sharp_clarke
running docker compose up -d

We also could monitor the n8n application running on Docker, by submitting command line :

docker compose logs -f n8n

The output can be shown belows:

Log of n8n running on Docker

Until this step, the n8n instance was running successfully on the system.

Step 4 — Access n8n Self Hosted Dashboard

Open your preferred web browser and navigate to your domain address. If everything is configured correctly, your n8n dashboard should appear at http://localhost:5678. Simply follow the on-screen instructions to finish the initial configuration process.

n8n setup owner account web prompt
n8n customization process, which is fits with our purpose
n8n main menu

Until this step, we have successfully install n8n on top of Docker On Ubuntu 24.04 LTS operating system.

If your n8n installation will be exposed to the public internet, security must become a top priority. Running the service without proper protection can leave your server vulnerable to unauthorized access, brute-force attacks, or data interception. A production-grade deployment requires multiple security layers to protect both your infrastructure and your workflows.

To strengthen security, we will use Nginx as a reverse proxy. Nginx will handle incoming web traffic, manage HTTPS termination, and forward requests securely to the internal n8n service. This setup prevents direct exposure of application ports and allows better control over headers, rate limiting, and access rules.

In addition, we will configure the firewall to allow only necessary ports such as SSH, HTTP, and HTTPS. To encrypt traffic and secure data transmission, we will install Certbot and obtain a trusted TLS certificate from Let’s Encrypt. With HTTPS properly configured, your n8n instance will be protected with industry-standard encryption, ensuring secure communication between users and your server.

Step 5 – Install and Configure Nginx And Certbot

To install Nginx we will submit the following command line :

sudo apt install nginx -y
sudo certbot --nginx -d n8n.dev01-bckinfo --email admin@bcknfo.com --agree-tos --non-interactive

Step 6 – Configure Firewall Rules

Configure Firewall Rules. The web will be using https, so we need to open the port 80 and 443 as shown below:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Summary

Deploying n8n on Ubuntu 24.04 LTS using Docker is practical and powerful. You end up with a secure, flexible workflow automation platform you fully control. From updating your server to configuring HTTPS and launching n8n via Docker Compose, this guide has walked you through every step with clear commands and explanations.

(Visited 13 times, 1 visits today)

You may also like