How to Install n8n on a VPS : Easy Docker Method for Beginners
Table of Contents
2. OS Selection
3. VPS Requirements
4. Installation Steps
5. Troubleshooting
6. Maintenance
Who This Guide Is For
This guide is designed for:
- ✓ Absolute beginners with no Linux experience
- ✓ Users who want a quick, reliable n8n deployment
- ✓ Anyone seeking a production-ready setup
Note: Simply copy and paste the commands. No prior knowledge required.
Prerequisites
- ● A VPS from any provider (DigitalOcean, Linode, Vultr, etc.)
- ● Your VPS IP address
- ● Root password or SSH key access
Operating System Selection
✓
Recommended
Ubuntu 22.04 LTS
- Beginner-friendly
- Best Docker compatibility
- Long-term support
- Stable & secure
✗
Not Recommended
- Windows VPS
- CentOS
- Other Linux distributions
VPS Requirements
Minimum
| CPU | 1 Core |
| RAM | 1 GB |
| Storage | 20 GB SSD |
Recommended
| CPU | 2 Cores |
| RAM | 2 GB+ |
| Storage | 40 GB SSD |
Installation Steps
Connect to Your VPS
Open Terminal (Mac/Linux) or PowerShell (Windows) and connect via SSH:
ssh root@YOUR_VPS_IPEnter your password when prompted.
Update System Packages
Ensure your system is up to date:
apt update && apt upgrade -yInstall Required Tools
apt install -y curl nanoConfigure Firewall
⚠️ Important: Required for n8n to be accessible
ufw allow 5678ufw reloadInstall Docker
Install Docker using the official script:
curl -fsSL https://get.docker.com | shEnable and start Docker service:
systemctl enable dockersystemctl start dockerInstall Docker Compose
apt install -y docker-composeCreate Project Directory
mkdir n8ncd n8nCreate Docker Compose Configuration
Open the configuration file:
nano docker-compose.ymlPaste the following configuration:
# n8n Docker Compose Configuration services: n8n: image: n8nio/n8n:latest restart: always ports: - "5678:5678" volumes: - ./data:/home/node/.n8n environment: - N8N_SECURE_COOKIE=false
Save & Exit: Press Ctrl + O → Enter → Ctrl + X
Launch n8n
docker-compose up -dWait 10-20 seconds for the container to initialize.
Access n8n
Open your browser and navigate to:
http://YOUR_VPS_IP:5678✓ Installation Complete — n8n is now running!
Troubleshooting
Container Keeps Restarting
This usually occurs due to permission issues with the data directory.
Solution: Fix folder ownership by running these commands:
Step 1: Stop container
docker-compose down
Step 2: Fix permissions
chown -R 1000:1000 ./data
Step 3: Restart container
docker-compose up -d
Verify: After 30 seconds, check container status:
docker psStatus should show “Up X seconds” without restarting.
Maintenance
Update n8n to Latest Version
docker-compose pull && docker-compose up -dWhy Docker?
One-time setup
Auto-restart on reboot
Easy updates
Production-ready
Recommendation
Always use the Docker method for production deployments.
Node.js installation is suitable for development only.