Skip to main content

Installation Guide

This guide covers different installation methods for n8n, from local development to production deployments. Choose the method that best fits your infrastructure and requirements.
Requirements:
  • Node.js 22.16+ (for npm installation)
  • Docker 20.10+ (for Docker installation)
  • PostgreSQL 13+ (recommended for production)

Installation Methods

npm

Best for local development and small deployments

Docker

Recommended for production and containerized environments

Kubernetes

Best for large-scale, highly available deployments

npm Installation

Global Installation

Install n8n globally using npm:
1

Install n8n

2

Start n8n

n8n will start and be accessible at http://localhost:5678
3

Configure (Optional)

Set environment variables for your setup:

Quick Start (No Installation)

For trying n8n without installation:
Use npx for quick tests and demos. For production, use a proper installation method.

Running Specific Commands

The n8n CLI supports multiple commands:
The n8n binary is located at /packages/cli/bin/n8n in the source code. It checks your Node.js version and loads the configuration before starting.

Docker Installation

Basic Docker Setup

1

Create Data Volume

2

Run n8n Container

3

Check Status

Docker Compose Setup

For production deployments, use Docker Compose:
docker-compose.yml
Deploy with:
Always set a strong N8N_ENCRYPTION_KEY in production. This key encrypts sensitive data like credentials. If lost, you cannot decrypt existing credentials.

Docker Compose with Queue Mode

For high-volume workflows, use queue mode with separate worker instances:
docker-compose-queue.yml
Queue mode requires Redis and separates the main instance (UI + triggers) from worker instances (workflow execution). This allows horizontal scaling of workers.

Configuration

Essential Environment Variables

n8n is highly configurable through environment variables:

Database Configuration

SQLite is not recommended for production use. Use PostgreSQL for better performance and reliability.

Security Configuration

Webhook & URL Configuration

Execution Configuration

Logging & Monitoring

For a complete list of configuration options, see the n8n documentation or check /packages/cli/src/config/ in the source code.

Configuration File

Alternatively, use a configuration file:
config/default.json
Place this file in the ~/.n8n/config/ directory or set NODE_CONFIG_DIR environment variable.

Production Deployment

Reverse Proxy Setup (nginx)

For production, put n8n behind a reverse proxy:

Systemd Service

Create a systemd service for n8n:
/etc/systemd/system/n8n.service
Enable and start:

Building from Source

For development or custom builds:
1

Clone Repository

2

Install Dependencies

3

Build All Packages

Build output is redirected to avoid overwhelming the console. Check build.log for any errors.
4

Start Development

n8n uses a monorepo structure with pnpm workspaces. Always use pnpm instead of npm or yarn.

Advanced Configuration

Multi-Main Setup (High Availability)

For enterprise deployments, enable multi-main mode:
Multi-main setup requires:
  • Queue mode (Redis)
  • Enterprise license
  • PostgreSQL database
  • Multiple n8n main instances

External Secrets

Load sensitive values from external sources:

Custom Node Loading

Load custom nodes from a directory:

Upgrading n8n

npm Upgrade

Docker Upgrade

Always backup your database before upgrading. n8n runs database migrations automatically on startup.

Backup & Recovery

Backup Database

Backup n8n Data Directory

Monitoring & Health Checks

Health Check Endpoint

n8n exposes a health check endpoint:

Metrics (Prometheus)

Enable Prometheus metrics:
Metrics are available at:

Troubleshooting

Database Connection Issues

1

Check Database

2

Verify Configuration

Check environment variables are set correctly:
3

Check Logs

Performance Issues

  • Use PostgreSQL instead of SQLite
  • Enable queue mode for high-volume workflows
  • Increase worker instances
  • Configure execution timeouts appropriately
  • Enable database connection pooling

Permission Errors

Getting Help

Community Forum

Get installation support from the community

Documentation

Detailed configuration documentation

GitHub Issues

Report installation bugs

Enterprise Support

Contact for enterprise installation support