How to Install n8n - Complete Guide
Previous: What is n8n
Complete Installation Guide

How to Install n8n: Complete Guide

Step-by-step guide to install n8n on Windows, macOS, Linux, using Docker, npm, or cloud platforms. Choose the best method for your needs and start building AI workflows today.

Tech Team January 15, 2025 10 min read 18.7K views 521 likes
n8n Docker Node.js VPS Cloud CLI

What is n8n?

n8n (pronounced "n-eight-n") is a workflow automation platform that connects apps and services using a visual drag-and-drop interface. It's open-source, self-hostable, and supports over 500+ integrations including Slack, Google Sheets, Notion, GitHub, and AI tools like OpenAI and Gemini.

n8n allows you to build complex automations without writing code, while also giving developers the flexibility to add custom JavaScript or Python logic when needed. It's used by companies of all sizes for:

  • AI Workflows: Build AI agents and automation
  • Data Processing: Extract, transform, and load data
  • Notifications: Send alerts to Slack, Email, or Teams
  • API Integration: Connect multiple APIs seamlessly
  • Internal Automation: Automate repetitive tasks
Quick Fact: n8n is used by over 50,000+ companies worldwide and has been downloaded 10+ million times.

Local vs Cloud

Before installing, choose the deployment method that fits your needs:

Feature Local Installation Cloud / VPS
Purpose Learning, testing, development Production, 24/7 automation
Uptime Requires PC on Always on
Webhooks Limited (localhost) Fully functional
Setup Difficulty Easy Moderate
Cost Free VPS cost or n8n.cloud paid
Data Control Full control Full control (VPS)
Performance Depends on hardware Consistent and scalable
Pro Tip: Start with local installation for learning and testing. Move to VPS or n8n.cloud when you have production-ready workflows.

Prerequisites

Before installing n8n, make sure you have:

  • Node.js 16+ (if using npm installation method)
  • Docker (if using Docker installation)
  • Internet connection for downloading dependencies
  • Basic terminal/command-line knowledge
Important: For production deployments, you'll also need:
  • A domain name (e.g., n8n.yourdomain.com)
  • SSL certificate (HTTPS)
  • VPS or cloud server (e.g., DigitalOcean, AWS, Hetzner)

Docker Installation

Docker is the easiest and most reliable way to install n8n. It works on all platforms (Windows, macOS, Linux) and provides a clean, isolated environment.

Step 1: Install Docker

šŸ“„ Windows

Download and install Docker Desktop from docker.com. Follow the installation wizard.

šŸŽ macOS

Download Docker Desktop for Mac from the official website or use Homebrew:

šŸ’» Terminal brew install --cask docker
🐧 Linux (Ubuntu/Debian)

Run the following commands:

šŸ’» Terminal sudo apt update
sudo apt install docker.io docker-compose -y
sudo usermod -aG docker $USER

Log out and back in for the group changes to take effect.

Step 2: Run n8n with Docker

Open your terminal and run:

šŸ’» Terminal docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n
Done! n8n is now running. Open your browser and go to http://localhost:5678

Step 3: Docker Compose (Recommended for Production)

Create a file named docker-compose.yml:

šŸ“„ docker-compose.yml version: '3.8'
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    volumes:
      - ~/.n8n:/home/node/.n8n
    environment:
      - N8N_ENCRYPTION_KEY=your-secret-key
      - N8N_HOST=localhost
      - N8N_PORT=5678

Then run:

šŸ’» Terminal docker-compose up -d

npm Installation

If you're a developer familiar with Node.js, installing n8n via npm is straightforward.

Step 1: Install Node.js and npm

šŸ“„ Windows

Download and install Node.js from nodejs.org. Choose the LTS version.

šŸŽ macOS

Use Homebrew:

šŸ’» Terminal brew install node
🐧 Linux

Install npm first, then nvm (Node Version Manager):

šŸ’» Terminal sudo apt-get install npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
nvm install 22

Step 2: Install n8n

šŸ’» Terminal npm install -g n8n
Note for Linux: You may need to use sudo:
sudo npm install -g n8n

Step 3: Run n8n

šŸ’» Terminal n8n

You should see: Editor is now accessible via: http://localhost:5678

Windows Installation

On Windows, you have three options:

Option 1: Docker (Recommended)

  1. Install Docker Desktop from docker.com
  2. Open Command Prompt or PowerShell as Administrator
  3. Run the Docker command:
docker run -it --rm --name n8n -p 5678:5678 -v %USERPROFILE%\.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n

Option 2: npm

  1. Download and install Node.js from nodejs.org
  2. Open Command Prompt as Administrator
  3. Run:
npm install -g n8n
n8n

Option 3: Standalone Executable

  1. Download the Windows executable from n8n's GitHub releases
  2. Extract the archive
  3. Run n8n.exe
Note: The standalone executable is less common. Docker or npm are recommended.

macOS Installation

On macOS, you have three options:

Option 1: Docker (Recommended)

  1. Install Docker Desktop from docker.com
  2. Open Terminal
  3. Run the Docker command:
docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n

Option 2: npm

  1. Install Node.js: brew install node
  2. Install n8n:
npm install -g n8n
n8n

Option 3: Homebrew

brew install n8n
Note: Homebrew installation is less common. Docker is the most reliable method.

Linux Installation

On Linux (Ubuntu/Debian), you have three options:

Option 1: Docker (Recommended)

šŸ’» Terminal # Install Docker
sudo apt update
sudo apt install docker.io docker-compose -y
sudo usermod -aG docker $USER

# Run n8n
docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n

Option 2: npm

šŸ’» Terminal # Install Node.js
sudo apt-get install npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
nvm install 22

# Install n8n
sudo npm install -g n8n

# Run n8n
n8n

Option 3: Snap

sudo snap install n8n
Note: Snap installation is available but Docker or npm are more common.

VPS Production Setup

For production deployments, here's a complete setup guide with Docker, Nginx, and SSL.

Step 1: Set up a VPS

Choose a provider: DigitalOcean, AWS, Hetzner, or Vultr. Use Ubuntu 22.04 or 24.04.

Step 2: Install Docker

šŸ’» Terminal sudo apt update
sudo apt install docker.io docker-compose -y
sudo usermod -aG docker $USER

Step 3: Create docker-compose.yml

šŸ“„ docker-compose.yml version: '3.8'
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    volumes:
      - ./n8n_data:/home/node/.n8n
    environment:
      - N8N_ENCRYPTION_KEY=your-strong-secret-key
      - N8N_HOST=your-domain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://your-domain.com/
Important: Generate a strong encryption key:
openssl rand -base64 32

Step 4: Run n8n

docker-compose up -d

Step 5: Set up Nginx with SSL

Install Nginx and Certbot:

šŸ’» Terminal sudo apt install nginx certbot python3-certbot-nginx -y

Create Nginx configuration:

šŸ“„ /etc/nginx/sites-available/n8n server {
  listen 80;
  server_name your-domain.com;
  return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl http2;
  server_name your-domain.com;

  location / {
    proxy_pass http://localhost:5678;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}

Enable the site and get SSL:

sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo certbot --nginx -d your-domain.com
Done! Your n8n is now live at https://your-domain.com

Cloud Setup (n8n.cloud)

If you prefer a managed solution, n8n offers cloud hosting:

  1. Go to n8n.cloud
  2. Sign up for a 14-day free trial (no credit card required)
  3. Choose your plan (Starter, Pro, or Enterprise)
  4. Start building workflows immediately
Plan Price Workflows Executions Users
Starter Free (14 days) 5 5,000/month 1
Pro $20/month 20 50,000/month 5
Team $50/month Unlimited 200,000/month 10
Enterprise Custom Unlimited Custom Unlimited

Troubleshooting

Port 5678 is already in use

Change the port:

docker run -it --rm --name n8n -p 8080:5678 docker.n8n.io/n8nio/n8n

Or find and kill the process using the port.

Permission denied (Linux)

Use sudo with npm commands, or add your user to the Docker group:

sudo usermod -aG docker $USER

Log out and back in for the changes to take effect.

n8n not accessible from other devices

By default, n8n only listens on localhost. For network access, use:

n8n --host=0.0.0.0

Or with Docker, use your server's IP address.

Webhooks not working locally

Localhost webhooks don't work from external services. Use ngrok for testing:

ngrok http 5678

For production, deploy to VPS with a domain.

Frequently Asked Questions

Is n8n free?

Yes! The self-hosted version of n8n is completely free and open-source. You only pay if you use n8n.cloud or need enterprise features.

What are the system requirements for n8n?

Minimum: 2GB RAM, 1 CPU core. Recommended: 4GB RAM, 2 CPU cores. Storage depends on your workflow data (starting at 10GB).

Can I run n8n without Docker?

Yes! You can install n8n via npm, standalone executable, or even build from source. Docker is just the recommended method for its simplicity and reliability.

How do I update n8n?

For Docker: docker pull docker.n8n.io/n8nio/n8n then restart your container.
For npm: npm install -g n8n@latest
Always backup your data before updating.

Can I use n8n with a database?

Yes! By default n8n uses SQLite. For production, it supports PostgreSQL, MySQL, and MariaDB. Configure via environment variables.

How do I secure my n8n instance?

Use HTTPS with SSL (Let's Encrypt), set a strong N8N_ENCRYPTION_KEY, enable authentication, use a firewall, and keep n8n updated.

Where are n8n workflows stored?

Workflows are stored in the ~/.n8n folder (or the volume you mounted). The database file is ~/.n8n/database.sqlite.

Built with ā¤ļø by The Tech Team

© 2025 All rights reserved. n8nĀ® is a trademark of n8n GmbH.