Tips

How to Install n8n on a VPS : Easy Docker Method for Beginners

Table of Contents

1. Prerequisites
2. OS Selection
3. VPS Requirements
4. Installation Steps
5. Troubleshooting
6. Maintenance

Who This Guide Is For

This guide is designed for:

  • Absolute beginners with no Linux experience
  • Users who want a quick, reliable n8n deployment
  • Anyone seeking a production-ready setup

Note: Simply copy and paste the commands. No prior knowledge required.

⚙️

Prerequisites

  • A VPS from any provider (DigitalOcean, Linode, Vultr, etc.)
  • Your VPS IP address
  • Root password or SSH key access

Operating System Selection

Recommended

Ubuntu 22.04 LTS

  • Beginner-friendly
  • Best Docker compatibility
  • Long-term support
  • Stable & secure

Not Recommended

  • Windows VPS
  • CentOS
  • Other Linux distributions

VPS Requirements

Minimum

CPU 1 Core
RAM 1 GB
Storage 20 GB SSD

Recommended

CPU 2 Cores
RAM 2 GB+
Storage 40 GB SSD

Installation Steps

1

Connect to Your VPS

Open Terminal (Mac/Linux) or PowerShell (Windows) and connect via SSH:

ssh root@YOUR_VPS_IP

Enter your password when prompted.

2

Update System Packages

Ensure your system is up to date:

apt update && apt upgrade -y

3

Install Required Tools

apt install -y curl nano

4

Configure Firewall

⚠️ Important: Required for n8n to be accessible

ufw allow 5678
ufw reload

5

Install Docker

Install Docker using the official script:

curl -fsSL https://get.docker.com | sh

Enable and start Docker service:

systemctl enable docker
systemctl start docker

6

Install Docker Compose

apt install -y docker-compose

7

Create Project Directory

mkdir n8n
cd n8n

8

Create Docker Compose Configuration

Open the configuration file:

nano docker-compose.yml

Paste the following configuration:

# n8n Docker Compose Configuration
services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    volumes:
      - ./data:/home/node/.n8n
    environment:
      - N8N_SECURE_COOKIE=false

Save & Exit: Press Ctrl + O → Enter → Ctrl + X

9

Launch n8n

docker-compose up -d

Wait 10-20 seconds for the container to initialize.

10

Access n8n

Open your browser and navigate to:

http://YOUR_VPS_IP:5678

✓ Installation Complete — n8n is now running!

Troubleshooting

Container Keeps Restarting

This usually occurs due to permission issues with the data directory.

Solution: Fix folder ownership by running these commands:

Step 1: Stop container

docker-compose down

Step 2: Fix permissions

chown -R 1000:1000 ./data

Step 3: Restart container

docker-compose up -d

Verify: After 30 seconds, check container status:

docker ps

Status should show “Up X seconds” without restarting.

Maintenance

Update n8n to Latest Version

docker-compose pull && docker-compose up -d

Why Docker?


One-time setup

Auto-restart on reboot

Easy updates

Production-ready

Recommendation

Always use the Docker method for production deployments.
Node.js installation is suitable for development only.

Leave a Reply