
Complete n8n Setup Guide: Install, Configure & Automate Workflows on Any Device
Table of Contents
What You'll Learn
By the end of this comprehensive guide, you'll know how to install and configure n8n on Windows, Mac, Linux, Docker, and cloud platforms. You'll also learn how to create your first automation workflow, implement security best practices, and troubleshoot common issues.
n8n is a powerful, open-source workflow automation tool that helps you connect apps and automate repetitive tasks. Whether you're automating data synchronization, building API integrations, or creating complex business workflows, n8n provides a visual, code-optional interface that makes automation accessible to everyone.
What is n8n?
n8n (pronounced "n-eight-n") is a fair-code licensed workflow automation tool that allows you to connect different services and applications to automate tasks. Think of it as a more flexible, self-hostable alternative to Zapier or Make (formerly Integlyomat).
Key Features of n8n
- 400+ integrations with popular services (Google Sheets, Slack, GitHub, Notion, and more)
- Visual workflow editor with drag-and-drop interface
- Self-hostable - full control over your data and workflows
- Code when needed - supports JavaScript, Python, and SQL
- Open source - transparent, extensible, and community-driven
- Free self-hosted option - no workflow or execution limits
Why Use n8n for Automation?
n8n stands out in the workflow automation space for several compelling reasons:
Data Privacy & Control
Self-host n8n on your own infrastructure for complete data ownership and privacy.
- No data sent to third parties
- Full control over workflow execution
- GDPR and compliance friendly
- On-premise deployment options
Cost-Effective
Free for self-hosted deployments with unlimited workflows and executions.
- No per-workflow pricing
- Unlimited executions
- No hidden costs
- Scale without extra fees
Developer Friendly
Extend functionality with custom code and create your own integrations.
- JavaScript and Python support
- Custom node development
- API and webhook triggers
- Version control compatible
Flexibility
Run on any platform and integrate with virtually any service.
- Cross-platform compatibility
- Docker support
- Cloud or on-premise
- Extensive integration library
Prerequisites Before Setup
Before installing n8n, ensure you have the following prerequisites based on your chosen installation method:
System Requirements
For npm/Node.js Installation:
- • Node.js version 18.10 or higher (LTS version recommended)
- • npm (comes with Node.js) or yarn package manager
- • Minimum 2GB RAM (4GB recommended)
- • 1GB free disk space
For Docker Installation:
- • Docker Engine 20.10 or higher
- • Docker Compose (optional but recommended)
- • Minimum 2GB RAM
- • 2GB free disk space
For Cloud Setup:
- • n8n Cloud account (free tier available)
- • Modern web browser
- • Internet connection
Installation Options Overview
n8n offers multiple installation methods to suit different use cases and technical expertise levels:
n8n Cloud
Quickest setup, managed hosting
Docker
Best for production, easy updates
npm/npx
Good for development, quick testing
Setting Up n8n on Windows
Windows users have two primary options: using npm (Node Package Manager) or Docker Desktop.
Method 1: Using npm (Windows)
Install Node.js
Download and install Node.js from the official website.
Verify Node.js Installation
Open Command Prompt or PowerShell and verify the installation.
node --version
npm --versionInstall n8n Globally
Use npm to install n8n globally on your system.
npm install n8n -gStart n8n
Launch n8n from the command line.
n8n startFirst Startup
After running n8n start, n8n will be accessible at http://localhost:5678. The first time you access it, you'll be prompted to create an admin account.
Method 2: Using Docker Desktop (Windows)
Install Docker Desktop
Download and install Docker Desktop for Windows.
Run n8n Container
Pull and run the n8n Docker image.
docker run -it --rm ^
--name n8n ^
-p 5678:5678 ^
-v n8n_data:/home/node/.n8n ^
n8nio/n8nSetting Up n8n on Mac
Mac users can install n8n using Homebrew, npm, or Docker. We'll cover all three methods.
Method 1: Using Homebrew (Recommended for Mac)
Install Homebrew (if not installed)
Homebrew is a package manager for macOS.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install Node.js via Homebrew
Use Homebrew to install Node.js.
brew install nodeInstall n8n
Use npm to install n8n globally.
npm install n8n -gStart n8n
Launch n8n from the terminal.
n8n startMethod 2: Using Docker (Mac)
Install Docker Desktop
Download and install Docker Desktop for Mac.
Run n8n Container
Execute the Docker run command in Terminal.
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
n8nio/n8nSetting Up n8n on Linux
Linux offers the most flexibility for n8n installation. Here's how to set it up on Ubuntu/Debian-based systems.
Using npm on Linux (Ubuntu/Debian)
Update System Packages
Ensure your system is up to date.
sudo apt update
sudo apt upgrade -yInstall Node.js and npm
Install Node.js using NodeSource repository.
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejsInstall n8n
Install n8n globally using npm.
sudo npm install n8n -gStart n8n
Launch n8n on your Linux system.
n8n startRunning n8n as a Service
For production use on Linux, it's recommended to run n8n as a systemd service so it starts automatically on boot and restarts on failure.
We'll cover this in the "Best Practices" section below.
Docker Installation (Recommended)
Docker is the recommended installation method for production environments. It provides isolation, easy backups, and simple updates.
Using Docker Compose (Best Practice)
Create Project Directory
Create a dedicated directory for your n8n setup.
mkdir n8n-docker
cd n8n-dockerCreate docker-compose.yml
Create a docker-compose file for persistent configuration.
version: '3.8'
services:
n8n:
image: n8nio/n8n
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your_secure_password
- N8N_HOST=localhost
- N8N_PORT=5678
- N8N_PROTOCOL=http
- WEBHOOK_URL=http://localhost:5678/
volumes:
- n8n_data:/home/node/.n8n
- ./local-files:/files
volumes:
n8n_data:Start n8n with Docker Compose
Launch n8n using docker-compose.
docker-compose up -dVerify Installation
Check that n8n is running.
docker-compose ps
docker-compose logs -f n8nUseful Docker Commands for n8n
docker-compose downStop n8ndocker-compose up -dStart n8ndocker-compose restartRestart n8ndocker-compose pull && docker-compose up -dUpdate to latest versionn8n Cloud Setup
n8n Cloud is the fastest way to get started with n8n. It's a fully managed service that handles hosting, updates, and maintenance for you.
Sign Up for n8n Cloud
Create your n8n Cloud account.
Choose Your Plan
Select a plan that fits your needs.
Access Your Instance
Your n8n instance will be ready immediately.
Cloud vs Self-Hosted
Choose Cloud if: You want the quickest setup, don't want to manage infrastructure, or need guaranteed uptime and automatic backups.
Choose Self-Hosted if: You need complete data control, want to avoid recurring costs, require on-premise deployment, or have complex security requirements.
Initial Configuration
After installing n8n, there are several important configuration steps to complete before building your first workflow.
Creating Your Admin Account
Access n8n Interface
Open your browser and navigate to n8n.
Set Up Account
Create your admin credentials.
Essential Environment Variables
For production deployments, configure these important environment variables:
# Basic Auth (for simple authentication)
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=your_username
N8N_BASIC_AUTH_PASSWORD=your_secure_password
# Host Configuration
N8N_HOST=yourdomain.com
N8N_PORT=5678
N8N_PROTOCOL=https
# Webhook URL (for external services to reach n8n)
WEBHOOK_URL=https://yourdomain.com/
# Timezone
GENERIC_TIMEZONE=America/New_York
# Execution Data
EXECUTIONS_DATA_SAVE_ON_ERROR=all
EXECUTIONS_DATA_SAVE_ON_SUCCESS=all
EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
# Security
N8N_ENCRYPTION_KEY=your_random_encryption_key_hereImportant Security Notes
- • Always use HTTPS in production environments
- • Change default passwords immediately
- • Generate a strong encryption key and keep it secure
- • Never commit sensitive credentials to version control
- • Use environment variables for sensitive data
Creating Your First Workflow
Let's create a simple workflow to verify your n8n installation and learn the basics. We'll create a workflow that sends a Slack notification when a webhook is triggered.
Create New Workflow
Start building your first automation.
Add Webhook Trigger
Set up a webhook to trigger the workflow.
Add Processing Node (Optional)
Transform or process the incoming data.
Test the Workflow
Execute and verify your workflow.
Congratulations!
You've successfully created your first n8n workflow! From here, you can explore the 400+ integrations available, create more complex workflows, and automate your business processes.
Best Practices and Security
Follow these best practices to ensure your n8n installation is secure, reliable, and performant.
Security Best Practices
- Enable HTTPS with SSL certificates (Let's Encrypt)
- Use strong passwords and enable 2FA when available
- Keep n8n and dependencies updated regularly
- Restrict network access with firewalls
- Use environment variables for credentials
- Implement regular backups of workflow data
Performance Optimization
- Use Docker for better resource isolation
- Configure execution data retention policies
- Use queue mode for high-volume workflows
- Monitor system resources (CPU, RAM, disk)
- Optimize workflows to reduce execution time
- Use PostgreSQL for better performance at scale
Running n8n as a Systemd Service (Linux)
For production Linux deployments, configure n8n to run as a systemd service:
# Create service file
sudo nano /etc/systemd/system/n8n.service
# Add this content:
[Unit]
Description=n8n workflow automation
After=network.target
[Service]
Type=simple
User=n8n
WorkingDirectory=/home/n8n
Environment="N8N_HOST=yourdomain.com"
Environment="N8N_PORT=5678"
Environment="N8N_PROTOCOL=https"
Environment="WEBHOOK_URL=https://yourdomain.com/"
ExecStart=/usr/bin/n8n start
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
# Enable and start the service
sudo systemctl enable n8n
sudo systemctl start n8n
sudo systemctl status n8nCommon Issues and Solutions
Here are solutions to common problems you might encounter when setting up n8n:
Port 5678 Already in Use
Problem: Error message "Port 5678 is already in use"
Solution: Either stop the process using port 5678 or configure n8n to use a different port:
N8N_PORT=5679 n8n startNode Version Incompatibility
Problem: Error about Node.js version being too old
Solution: Update Node.js to version 18.10 or higher using nvm or your package manager:
nvm install --lts && nvm use --ltsWebhooks Not Working
Problem: External services can't reach your webhooks
Solution: Ensure WEBHOOK_URL is set correctly and your firewall allows incoming connections. For local testing, use tools like ngrok:
ngrok http 5678Docker Container Won't Start
Problem: Docker container exits immediately
Solution: Check logs for errors and ensure volume permissions are correct:
docker logs n8ndocker-compose logs -fHigh Memory Usage
Problem: n8n consuming too much RAM
Solution: Configure execution data retention and limit saved executions:
EXECUTIONS_DATA_MAX_AGE=168 # Keep for 7 daysSupercharge Your Development Workflow
Now that you have n8n set up, explore our other development tools to enhance your productivity:
You're Ready to Automate!
Congratulations! You now have a fully functional n8n installation. Start exploring the vast library of integrations, create powerful workflows, and automate your business processes. Remember to keep your installation secure, regularly backup your data, and join the n8n community for support and inspiration.
Ready to Build More?
Explore our complete suite of developer tools and productivity utilities to enhance your workflow automation journey.
Explore All Tools