n8n is a free and open-source workflow automation tool. n8n provides visual workflow automation with 200+ integrations, serving as a self-hosted alternative to Zapier, IFTTT, or Microsoft Power Automate
1. Prerequisites
2. Supported Operating Systems
This guide supports installation on:
3. Installation
RHEL/CentOS/Rocky Linux/AlmaLinux
# Install EPEL repository if needed
sudo dnf install -y epel-release
# Install n8n
sudo dnf install -y n8n
# Enable and start service
sudo systemctl enable --now n8n
# Configure firewall
sudo firewall-cmd --permanent --add-port=5678/tcp
sudo firewall-cmd --reload
# Verify installation
n8n --version
Debian/Ubuntu
# Update package index
sudo apt update
# Install n8n
sudo apt install -y n8n
# Enable and start service
sudo systemctl enable --now n8n
# Configure firewall
sudo ufw allow 5678
# Verify installation
n8n --version
Arch Linux
# Install n8n
sudo pacman -S n8n
# Enable and start service
sudo systemctl enable --now n8n
# Verify installation
n8n --version
Alpine Linux
# Install n8n
apk add --no-cache n8n
# Enable and start service
rc-update add n8n default
rc-service n8n start
# Verify installation
n8n --version
openSUSE/SLES
# Install n8n
sudo zypper install -y n8n
# Enable and start service
sudo systemctl enable --now n8n
# Configure firewall
sudo firewall-cmd --permanent --add-port=5678/tcp
sudo firewall-cmd --reload
# Verify installation
n8n --version
macOS
# Using Homebrew
brew install n8n
# Start service
brew services start n8n
# Verify installation
n8n --version
FreeBSD
# Using pkg
pkg install n8n
# Enable in rc.conf
echo 'n8n_enable="YES"' >> /etc/rc.conf
# Start service
service n8n start
# Verify installation
n8n --version
Windows
# Using Chocolatey
choco install n8n
# Or using Scoop
scoop install n8n
# Verify installation
n8n --version
Initial Configuration
Basic Configuration
# Create configuration directory
sudo mkdir -p /etc/n8n
# Set up basic configuration
# See official documentation for detailed configuration options
# Test configuration
n8n --version
5. Service Management
systemd (RHEL, Debian, Ubuntu, Arch, openSUSE)
# Enable service
sudo systemctl enable n8n
# Start service
sudo systemctl start n8n
# Stop service
sudo systemctl stop n8n
# Restart service
sudo systemctl restart n8n
# Check status
sudo systemctl status n8n
# View logs
sudo journalctl -u n8n -f
OpenRC (Alpine Linux)
# Enable service
rc-update add n8n default
# Start service
rc-service n8n start
# Stop service
rc-service n8n stop
# Restart service
rc-service n8n restart
# Check status
rc-service n8n status
rc.d (FreeBSD)
# Enable in /etc/rc.conf
echo 'n8n_enable="YES"' >> /etc/rc.conf
# Start service
service n8n start
# Stop service
service n8n stop
# Restart service
service n8n restart
# Check status
service n8n status
launchd (macOS)
# Using Homebrew services
brew services start n8n
brew services stop n8n
brew services restart n8n
# Check status
brew services list | grep n8n
Windows Service Manager
# Start service
net start n8n
# Stop service
net stop n8n
# Using PowerShell
Start-Service n8n
Stop-Service n8n
Restart-Service n8n
# Check status
Get-Service n8n
Advanced Configuration
See the official documentation for advanced configuration options.
Reverse Proxy Setup
nginx Configuration
upstream n8n_backend {
server 127.0.0.1:5678;
}
server {
listen 80;
server_name n8n.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name n8n.example.com;
ssl_certificate /etc/ssl/certs/n8n.example.com.crt;
ssl_certificate_key /etc/ssl/private/n8n.example.com.key;
location / {
proxy_pass http://n8n_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Apache Configuration
<VirtualHost *:80>
ServerName n8n.example.com
Redirect permanent / https://n8n.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName n8n.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/n8n.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/n8n.example.com.key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5678/
ProxyPassReverse / http://127.0.0.1:5678/
</VirtualHost>
HAProxy Configuration
frontend n8n_frontend
bind *:80
bind *:443 ssl crt /etc/ssl/certs/n8n.pem
redirect scheme https if !{ ssl_fc }
default_backend n8n_backend
backend n8n_backend
balance roundrobin
server n8n1 127.0.0.1:5678 check
Security Configuration
Basic Security Setup
# Set appropriate permissions
sudo chown -R n8n:n8n /etc/n8n
sudo chmod 750 /etc/n8n
# Configure firewall
sudo firewall-cmd --permanent --add-port=5678/tcp
sudo firewall-cmd --reload
# Enable SELinux policies (if applicable)
sudo setsebool -P httpd_can_network_connect on
Database Setup
See official documentation for database configuration requirements.
Performance Optimization
System Tuning
# Basic system tuning
echo 'net.core.somaxconn = 65535' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Monitoring
Basic Monitoring
# Check service status
sudo systemctl status n8n
# View logs
sudo journalctl -u n8n -f
# Monitor resource usage
top -p $(pgrep n8n)
9. Backup and Restore
Backup Script
#!/bin/bash
# Basic backup script
BACKUP_DIR="/backup/n8n"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/n8n-backup-$DATE.tar.gz" /etc/n8n /var/lib/n8n
echo "Backup completed: $BACKUP_DIR/n8n-backup-$DATE.tar.gz"
Restore Procedure
# Stop service
sudo systemctl stop n8n
# Restore from backup
tar -xzf /backup/n8n/n8n-backup-*.tar.gz -C /
# Start service
sudo systemctl start n8n
6. Troubleshooting
Common Issues
1. Service won't start:
# Check logs
sudo journalctl -u n8n -n 100
sudo tail -f /var/log/n8n/n8n.log
# Check configuration
n8n --version
# Check permissions
ls -la /etc/n8n
2. Connection issues:
# Check if service is listening
sudo ss -tlnp | grep 5678
# Test connectivity
telnet localhost 5678
# Check firewall
sudo firewall-cmd --list-all
3. Performance issues:
# Check resource usage
top -p $(pgrep n8n)
# Check disk I/O
iotop -p $(pgrep n8n)
# Check connections
ss -an | grep 5678
Integration Examples
Docker Compose Example
version: '3.8'
services:
n8n:
image: n8n:latest
ports:
- "5678:5678"
volumes:
- ./config:/etc/n8n
- ./data:/var/lib/n8n
restart: unless-stopped
Maintenance
Update Procedures
# RHEL/CentOS/Rocky/AlmaLinux
sudo dnf update n8n
# Debian/Ubuntu
sudo apt update && sudo apt upgrade n8n
# Arch Linux
sudo pacman -Syu n8n
# Alpine Linux
apk update && apk upgrade n8n
# openSUSE
sudo zypper update n8n
# FreeBSD
pkg update && pkg upgrade n8n
# Always backup before updates
tar -czf /backup/n8n-pre-update-$(date +%Y%m%d).tar.gz /etc/n8n
# Restart after updates
sudo systemctl restart n8n
Regular Maintenance
# Log rotation
sudo logrotate -f /etc/logrotate.d/n8n
# Clean old logs
find /var/log/n8n -name "*.log" -mtime +30 -delete
# Check disk usage
du -sh /var/lib/n8n
Additional Resources
---
Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.