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
- Log in to DigitalOcean.
- Create a new Droplet with Ubuntu 22.04 (or latest version).
- Choose the Basic plan and select the $12/month option.
- Add your SSH key for secure access (or use a password).
- 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.
- Install PM2 globally:
npm install -g pm2
- Start n8n with PM2:
pm2 start n8n --name n8n
- 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
- Install Ngrok (MacBook):
brew install ngrok
- Start Ngrok on port 5678:
ngrok http 5678
- 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! ๐ฌ
0 Comments