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.
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
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 |
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
- 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
Download and install Docker Desktop from docker.com. Follow the installation wizard.
Download Docker Desktop for Mac from the official website or use Homebrew:
brew install --cask docker
Run the following commands:
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:
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Step 3: Docker Compose (Recommended for Production)
Create a file named 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:
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
Download and install Node.js from nodejs.org. Choose the LTS version.
Use Homebrew:
brew install node
Install npm first, then nvm (Node Version Manager):
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
npm install -g n8n
sudo npm install -g n8n
Step 3: Run n8n
n8n
You should see: Editor is now accessible via: http://localhost:5678
Windows Installation #
On Windows, you have three options:
Option 1: Docker (Recommended)
- Install Docker Desktop from docker.com
- Open Command Prompt or PowerShell as Administrator
- 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
- Download and install Node.js from nodejs.org
- Open Command Prompt as Administrator
- Run:
npm install -g n8n
n8n
Option 3: Standalone Executable
- Download the Windows executable from n8n's GitHub releases
- Extract the archive
- Run n8n.exe
macOS Installation #
On macOS, you have three options:
Option 1: Docker (Recommended)
- Install Docker Desktop from docker.com
- Open Terminal
- 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
- Install Node.js: brew install node
- Install n8n:
npm install -g n8n
n8n
Option 3: Homebrew
brew install n8n
Linux Installation #
On Linux (Ubuntu/Debian), you have three options:
Option 1: Docker (Recommended)
# 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
# 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
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
sudo apt update
sudo apt install docker.io docker-compose -y
sudo usermod -aG docker $USER
Step 3: Create 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/
openssl rand -base64 32
Step 4: Run n8n
docker-compose up -d
Step 5: Set up Nginx with SSL
Install Nginx and Certbot:
sudo apt install nginx certbot python3-certbot-nginx -y
Create Nginx configuration:
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
Cloud Setup (n8n.cloud) #
If you prefer a managed solution, n8n offers cloud hosting:
- Go to n8n.cloud
- Sign up for a 14-day free trial (no credit card required)
- Choose your plan (Starter, Pro, or Enterprise)
- 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.
Share this article
Related Articles
What is n8n: Build AI Workflows
Learn how to build powerful AI workflows with n8n using Gemini and Slack integrations.
8 min read ā”n8n vs Zapier: Which is Better?
Compare n8n and Zapier for workflow automation - features, pricing, and use cases.
6 min read šn8n with Google Sheets
Step-by-step guide to connect n8n with Google Sheets for data automation.
5 min read šUsing Python in n8n Workflows
Learn how to add custom Python code to your n8n workflows for advanced logic.
7 min readFrequently 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.