Skip to content

N8N Automation

⚙️ Self‑Hosting n8n on Oracle Cloud (Free Tier)

Section titled “⚙️ Self‑Hosting n8n on Oracle Cloud (Free Tier)”

Automating repetitive tasks—social posting, data syncing, email processing—quickly becomes overwhelming.
n8n provides a powerful visual workflow engine, and hosting it yourself gives you full control.
This guide walks through deploying n8n on Ubuntu 24.04 using Oracle Cloud’s Free Tier, which offers a permanent, cost‑free VM.


CategoryDetails
Platformn8n (Self‑Hosted)
Cloud ProviderOracle Cloud Free Tier
Operating SystemUbuntu 24.04 LTS
RuntimeNode.js v22 (via NVM)
Process ManagerPM2
Reverse ProxyNGINX
SSLCertbot + Let’s Encrypt

StepDescription
Sign UpCreate an account at oracle.com/cloud/free
Deploy InstanceSelect Ubuntu 24.04
CredentialsSave public IP and SSH private key
ssh -i ~/path/to/key.key ubuntu@<your-ip>
chmod 400 ~/path/to/key.key
sudo apt update && sudo apt upgrade -y && sudo apt install -y \
build-essential curl wget git ufw ca-certificates gnupg \
lsb-release software-properties-common

ComponentPurpose
NVMManages Node.js versions
Node.js v22Required runtime for n8n
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
nvm install 22
nvm use 22
nvm alias default 22
node -v

ToolRole
PM2Keeps n8n running and restarts it automatically
Startup ScriptLoads environment variables and launches n8n
npm install -g pm2
pm2 -v
nano ~/start-n8n.sh

Script content:

#!/bin/sh
set -a
. ~/.n8n/.env
set +a
npx n8n

Make executable:

chmod +x ~/start-n8n.sh
pm2 start ~/start-n8n.sh --name n8n
pm2 startup
pm2 save

ComponentPurpose
NGINXHandles HTTP traffic and proxies to n8n
Port 80Public access
sudo apt update && sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
sudo nano /etc/nginx/sites-available/n8n

Add:

server {
    listen 80;
    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_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;
        proxy_buffering off;
        proxy_cache off;
        chunked_transfer_encoding off;
    }
}

Enable the site:

sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

ComponentPurpose
CertbotGenerates and manages SSL certificates
Let’s EncryptProvides free HTTPS certificates
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

Enable auto‑renewal:

sudo systemctl enable certbot.timer

sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo nano /etc/iptables/rules.v4

Apply:

sudo iptables-restore < /etc/iptables/rules.v4

Create:

nano ~/.n8n/.env

Example:

N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=yourusername
N8N_BASIC_AUTH_PASSWORD=yourpassword
WEBHOOK_TUNNEL_URL=https://your-domain.com/

Secure it:

chmod 600 ~/.n8n/.env

pm2 logs n8n
IssueFix
n8n not responding
pm2 restart n8n
Domain not resolvingCheck DNS A record
NGINX errors
sudo nginx -t
Firewall blockingVerify UFW rules
What to SaveFrequencyLocation
n8n configWeeklyCloud storage
.env fileMonthlyEncrypted drive
PM2 listMonthly
pm2 save
ScriptsAfter changesGit repo

This setup gives you a fully self‑hosted, secure, always‑free n8n instance running on Oracle Cloud.
You can now build workflows, integrate APIs, automate tasks, and scale as needed.