Ultimate Guide: Installing and Debugging n8n on DigitalOcean & MacBook (with Ngrok & PM2)

by | Mar 21, 2025 | Featured, My Blog & Thoughts, My Life & Passion, My Tech & Innovation | 0 comments

n8n is an incredibly powerful workflow automation tool. In this guide, we’ll cover step-by-step installation and debugging of n8n on a DigitalOcean Droplet as well as setting it up on a MacBook Air. We’ll also cover n8n Tunnel, Ngrok, and PM2 (Process Manager 2) to keep your n8n instance running smoothly.


๐ŸŒ Installing n8n on DigitalOcean ($12 Droplet)

Step 1: Create a DigitalOcean Droplet

  1. Log in to DigitalOcean.
  2. Create a new Droplet with Ubuntu 22.04 (or latest version).
  3. Choose the Basic plan and select the $12/month option.
  4. Add your SSH key for secure access (or use a password).
  5. Click Create Droplet and note the Public IP address.

Step 2: Connect to the Droplet via SSH

Run the following command from your terminal (replace your-ip with your dropletโ€™s IP address):

ssh root@your-ip

Step 3: Install Node.js & npm

n8n requires Node.js (LTS version) and npm. Install them with:

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

Verify installation:

node -v
npm -v

Step 4: Install n8n Globally

npm install -g n8n

Step 5: Run n8n

n8n

This starts n8n, but to keep it running continuously, use PM2.

Step 6: Install & Use PM2 (Process Manager 2)

PM2 ensures that n8n runs in the background even after a system restart.

  1. Install PM2 globally:
    npm install -g pm2
  2. Start n8n with PM2:
    pm2 start n8n --name n8n
  3. Ensure n8n starts on boot:
    pm2 startup
    pm2 save

Now n8n will always run in the background on your DigitalOcean server. ๐ŸŽ‰


๐Ÿ Installing n8n on MacBook Air (Local Setup)

Step 1: Install Node.js & npm

Install Node.js using Homebrew:

brew install node

Verify installation:

node -v
npm -v

Step 2: Install n8n Globally

npm install -g n8n

Step 3: Start n8n

n8n

This will start n8n, but the default URL will be localhost, which isnโ€™t accessible externally.


๐ŸŒ Exposing n8n to the Internet (Ngrok & n8n Tunnel)

By default, n8n runs on localhost, so you canโ€™t access it from another device. There are two ways to expose it:

Option 1: Using n8n Tunnel

n8n start --tunnel

This creates a temporary public URL using n8n’s built-in tunneling service.

Option 2: Using Ngrok

  1. Install Ngrok (MacBook):
    brew install ngrok
  2. Start Ngrok on port 5678:
    ngrok http 5678
  3. Copy the generated HTTPS URL and use it to access n8n from anywhere!

๐Ÿ’ก Note: The free version of Ngrok changes the URL every time it runs. To get a fixed domain, upgrade to a paid plan.


๐ŸŽฏ Debugging Common Issues

1. n8n Command Not Found

Run:

export PATH=$PATH:/usr/local/bin

Then restart your terminal.

2. Ngrok Not Updating Webhook URL in n8n

If n8n isn’t picking up the new Ngrok URL:

  • Restart n8n after starting Ngrok.
  • Ensure you’re using the correct webhook URL in integrations.

3. n8n Not Running After Server Reboot (DigitalOcean)

Make sure PM2 is managing n8n:

pm install -g pm2
pm2 start n8n --name n8n
pm2 save
pm2 startup

๐ŸŽ‰ Conclusion

You now have n8n running on both DigitalOcean and MacBook with external access via Ngrok & n8n Tunnel. Plus, PM2 ensures reliability on Ubuntu servers. ๐Ÿš€

Got questions? Drop them in the comments! ๐Ÿ’ฌ

Written by

Related Posts

0 Comments

Submit a Comment