n8n (pronounced “n-eight-n”) is a self-hosted workflow automation platform built for flexibility and control.
It allows you to automate anything from sending alerts and syncing data to building integrations or managing cloud processes all through visual nodes.

Unlike SaaS automation tools, n8n gives you full data ownership and the freedom to host it on your preferred infrastructure, including LetsCloud.

Goals

This guide will help you:

  1. Install and configure n8n manually on a fresh Ubuntu 24.04 instance
  2. Understand the components involved (Docker, PostgreSQL, Nginx)
  3. Manage and secure your n8n instance for production readiness
  4. Learn how to deploy instantly using the LetsCloud One-Click Image

Requirements

Before installing, make sure your environment meets the following requirements:

Requirement Description
Operating System Ubuntu 24.04 LTS (clean installation recommended)
Privileges User with sudo access
Internet Access Required for package installation and container downloads
Storage Minimum 20 GB SSD (recommended 40 GB for workflows and logs)
Memory (RAM) Minimum 2 GB, recommended 4 GB+ for production
CPU At least 2 vCPUs
Domain (optional) For HTTPS setup with Let’s Encrypt

Step-by-Step Installation on Ubuntu 24.04

1. Update the System

$

sudo apt update && sudo apt upgrade -y

2. Install Docker and Docker Compose

$$$

sudo apt install docker.io docker-compose -y sudo systemctl enable docker sudo systemctl start docker

3. Install PostgreSQL

$$$$

sudo apt install postgresql postgresql-contrib -y sudo -u postgres psql -c "CREATE DATABASE n8n;" sudo -u postgres psql -c "CREATE USER n8n_user WITH ENCRYPTED PASSWORD 'strongpassword';" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE n8n TO n8n_user;"

4. Create the n8n Docker Compose File

$$$

sudo mkdir -p /opt/n8n cd /opt/n8n sudo nano docker-compose.yml

Paste the following:

version: "3"
services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=localhost
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n_user
      - DB_POSTGRESDB_PASSWORD=strongpassword
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=yourpassword
      - N8N_HOST=your-domain.com
      - N8N_PORT=5678
    restart: always

Save and start:

$

sudo docker-compose up -d

5. Install and Configure Nginx

$$

sudo apt install nginx -y sudo nano /etc/nginx/conf.d/n8n.conf

Add this configuration:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:5678;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Restart Nginx:

$

sudo systemctl restart nginx

6. Enable HTTPS with Let’s Encrypt (Optional)

$$

sudo apt install certbot python3-certbot-nginx -y sudo certbot --nginx -d your-domain.com

7. Configure Firewall

$$$$

sudo ufw allow ssh sudo ufw allow 80 sudo ufw allow 443 sudo ufw enable

8. Access n8n

Open your browser and go to:

http://your-server-ip/

Complete the setup wizard and start building your first workflows.

Troubleshooting

If n8n doesn’t start:

$$

sudo docker ps sudo docker logs n8n-n8n-1

Check PostgreSQL:

$

sudo systemctl status postgresql

Verify Nginx:

$$

sudo nginx -t sudo tail -f /var/log/nginx/error.log

Backup and Restore

Backup your database:

$

sudo -u postgres pg_dump n8n > n8n_backup.sql

Restore:

$

sudo -u postgres psql -d n8n < n8n_backup.sql

One-Click Deployment with LetsCloud

If you don’t want to install everything manually, LetsCloud provides a ready-to-use n8n image, built with Packer and optimized for production.

Features

  • Pre-installed n8n, PostgreSQL, Nginx, and Docker
  • Automatic startup via systemd
  • Ready for SSL/TLS setup
  • Secure — no default credentials

How to Deploy

  1. Log in to your LetsCloud Dashboard
  2. Click Create Server
  3. Choose the n8n-24-04 image
  4. Select your region and plan
  5. Deploy — and start automating in minutes

Get Started on LetsCloud

Conclusion

Whether you prefer to build manually or use One-Click Deployment, n8n gives you the flexibility and control to automate your workflows with ease.
With LetsCloud, you can go from zero to automation in under five minutes.

Read more about: Operating SystemUbuntu