How to Install and Configure n8n on Oracle Cloud Always Free VM (Ubuntu 24.04)

n8n (short for nodemation) is an open-source workflow automation platform that allows you to connect applications and APIs, automate repetitive tasks, and build complex data workflows.
This guide explains how to install and configure n8n on Oracle Cloud Infrastructure (OCI) Always Free Tier, using Ubuntu 24.04 and the default SQLite database.
It also covers how to configure Nginx as a reverse proxy and enable HTTPS with Let’s Encrypt.

PrerequisitesBefore starting, ensure that you have:

  • An Oracle Cloud account with an Always Free compute instance
  • Ubuntu 24.04 server with SSH access
  • Root or sudo privileges
  • A registered domain name (optional but recommended)
  • Basic familiarity with Linux commands

Step 1: Update the System

Update all system packages to the latest versions.

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git

Step 2: Install Node.js and npm

n8n requires Node.js version 18 or higher. Use the official NodeSource setup script.

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

Check the versions:

node -v
npm -v

Update npm to the latest version.

sudo npm install -g npm@latest

Step 3: Install n8n Globally

Install n8n globally using npm.

sudo npm install -g n8n

Verify installation.

n8n

You should see:

Editor is now accessible via:
http://127.0.0.1:5678/

Press Ctrl + C to stop it.

Step 4: Configure Environment Variables

Create a configuration directory for n8n.

mkdir -p ~/.n8n
nano ~/.n8n/.env

Add the following content (modify username and password):

N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=StrongPassword123
N8N_HOST=0.0.0.0
N8N_PORT=5678
WEBHOOK_URL=https://automation.yourdomain.com
WEBHOOK_TUNNEL_URL=https://automation.yourdomain.com

Save the file and load the environment variables.

export $(cat ~/.n8n/.env | xargs)

Step 5: Create a Systemd Service for n8n

Create a service file to automatically start n8n on boot.

sudo nano /etc/systemd/system/n8n.service

Paste the following configuration.

[Unit]
Description=n8n Automation Service
After=network.target

[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/.n8n
EnvironmentFile=/home/ubuntu/.n8n/.env
ExecStart=/usr/bin/n8n
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Save and exit.

Reload and enable the service.

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable n8n
sudo systemctl start n8n
sudo systemctl status n8n --no-pager

If you see active (running), the service has started successfully.

Test n8n locally.

curl -I http://127.0.0.1:5678

Expected output:

HTTP/1.1 200 OK

Step 6: Install and Configure Nginx Reverse Proxy

Install Nginx.

sudo apt install -y nginx

Create a new configuration file for n8n.

sudo nano /etc/nginx/sites-available/n8n

Add the following content (replace your domain name).

server {
    listen 80;
    server_name n8n.syncbricks.com;

    location / {
        proxy_pass http://127.0.0.1:5678;
        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_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Enable the configuration and restart Nginx.

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

Step 7: Enable HTTPS with Let’s Encrypt

Install Certbot.

sudo apt install -y certbot python3-certbot-nginx

Request a free SSL certificate.

sudo certbot --nginx -d n8n.syncbricks.com

Verify the automatic renewal.

sudo systemctl list-timers | grep certbot
sudo certbot renew --dry-run

Step 8: Configure Oracle Cloud Network Rules

In the Oracle Cloud Console:

  1. Go to Networking → VCN → Subnets → Your Subnet
  2. Under Security List or Network Security Group, ensure the following inbound rules exist:
Source CIDRProtocolPortDescription
0.0.0.0/0TCP22SSH
0.0.0.0/0TCP80HTTP
0.0.0.0/0TCP443HTTPS
  1. Confirm that the route table points to an Internet Gateway.
  2. Make sure the instance has a public IPv4 address.

Step 9: Verify the Setup

Check that all services are running correctly.

sudo systemctl status n8n
sudo ss -ltnp | grep 5678
sudo nginx -t
curl -kI https://n8n.syncbricks.com

Expected output should include HTTP/1.1 200 OK.

Troubleshooting

n8n Service Fails with status=217/USER

This error occurs when the User= value in the systemd file is invalid.

Fix:

sudo nano /etc/systemd/system/n8n.service

Ensure it contains:

User=ubuntu

Then reload systemd.

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl restart n8n

Port 80 or 443 Not Accessible

This is usually caused by missing Oracle Cloud Security List or NSG rules.
Ensure TCP 80 and 443 are open for all sources (0.0.0.0/0).

WebSocket Connection Errors

Ensure these lines are present in your Nginx configuration.

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Step 10: Access n8n

Open your browser and navigate to:

https://automation.yourdomain.com

Log in with the username and password you defined in .env.

Conclusion

You have successfully installed and configured n8n on an Oracle Cloud Always Free VM using Ubuntu 24.04.
This setup provides a cost-free and secure environment to automate workflows, integrate cloud services, and connect your applications.

By running n8n under a systemd service with Nginx and Let’s Encrypt, you now have a reliable and production-ready automation platform that starts automatically, stays secure, and can scale as your needs grow.

Leave a Comment