If you work in digital marketing, development, or automation, you’ve probably heard about n8n. It’s one of the most flexible open-source automation tools available today. It allows you to connect apps, build automated workflows, send data between platforms, and manage your operations without writing code.
To run n8n smoothly, the best environment is a VPS. A Virtual Private Server gives you stability, speed, and full control over your setup. In this guide, you will learn why a VPS is the best place to run n8n and how to install it step-by-step.
Why Run n8n on a VPS?
Using a VPS for n8n gives you stability and ensures your automations run 24/7. Compared to running it on your personal computer, a VPS offers:
1. Continuous uptime
Your workflows run even when your laptop is off.
2. Full control
You can install anything you need such as Node.js, Docker, databases, and SSL certificates.
3. Higher security
You can configure firewall rules, block ports, and secure access to the panel.
4. Better performance
With SSD or NVMe VPS plans, n8n becomes significantly faster and more reliable.
What You Need Before Installing n8n
To install n8n on a VPS, make sure you have:
-
A Linux VPS (Ubuntu 22.04 recommended)
-
Root or sudo access
-
A domain name (optional but recommended for SSL)
-
Docker or Node.js
-
A stable internet connection
Method 1: Install n8n Using Docker (Recommended for Stability)
Docker is the most reliable and clean method. It keeps everything isolated and easy to restart or update.
Step 1 — Update the server
sudo apt update && sudo apt upgrade -y
Step 2 — Install Docker
sudo apt install docker.io -y sudo systemctl start docker sudo systemctl enable docker
Step 3 — Create a directory for n8n
mkdir n8n cd n8n
Step 4 — Run the n8n Docker container
docker run -it --rm \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ n8nio/n8n
Now open your browser and visit:
http://your-server-ip:5678
n8n will start immediately.
Method 2: Install n8n Without Docker (Node.js Installation)
If you prefer installing n8n directly, follow these steps.
Step 1 — Install Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install nodejs -y
Step 2 — Install n8n globally
sudo npm install n8n -g
Step 3 — Start n8n
n8n start
You can now access it from:
http://your-server-ip:5678
How to Enable SSL for n8n (Important for Security)
If you have a domain, you can secure your n8n installation with free SSL using Let’s Encrypt.
Install Certbot
sudo apt install certbot -y
Generate SSL certificates
sudo certbot certonly --standalone -d yourdomain.com
Add SSL details to n8n configuration
Set the following environment variables:
N8N_PROTOCOL=https N8N_SSL_KEY=/etc/letsencrypt/live/yourdomain.com/privkey.pem N8N_SSL_CERT=/etc/letsencrypt/live/yourdomain.com/fullchain.pem
Restart n8n once done.
How to Keep n8n Running Automatically (PM2 Method)
PM2 keeps n8n running in the background, even after restarting the VPS.
npm install pm2 -g pm2 start n8n pm2 save pm2 startup
Recommended VPS Specs for n8n
Different workflows need different resources:
Basic automations
-
1 vCPU
-
1–2 GB RAM
Medium workloads
-
2 vCPU
-
4 GB RAM
High-traffic automations or webhook-heavy setups
-
NVMe VPS
-
4–8 GB RAM
-
Stable CPU performance
Security Tips for Running n8n on a VPS
-
Change the default port (5678) to a custom port.
-
Protect your n8n instance with basic authentication.
-
Limit SSH access to specific IPs.
-
Enable UFW firewall:
sudo ufw allow 22 sudo ufw allow 80 sudo ufw allow 443 sudo ufw enable
Conclusion
Running n8n on a VPS is one of the best decisions you can make if you’re working with automation, workflows, or integrations. It gives you full control, stable performance, and reliable uptime. The installation steps are simple, and once n8n is running, you can automate almost anything in your business.
COMMENTS (0)
The list of comments is empty