1,384 words, 7 minutes read time.

If you’ve ever wanted to automate repetitive tasks, connect different apps, or manage workflows without relying entirely on cloud services, n8n is the tool you’ve been waiting for. It’s an open-source workflow automation platform that runs anywhere Node.js can run—including your trusty Raspberry Pi. Running n8n on a Pi is not only cost-effective, but it also gives you full control over your automations and keeps your data local.
In this guide, I’ll walk you through setting up n8n on a Raspberry Pi from scratch. We’ll cover everything from creating a dedicated user and installing Node.js 20.x, to setting up SSL certificates, configuring a systemd service, and accessing the web interface. Along the way, I’ll also give tips for handling dynamic DNS addresses, firewall ports for OAuth integrations, and ensuring your Pi becomes a tiny, always-on automation powerhouse. Whether you’re automating database tasks, sending notifications, or just exploring what’s possible with workflow automation, this guide will get you there step by step.
Step 1: Create the node User
Alright, first things first. We don’t want to run n8n as the default pi user—it’s messy and not very secure. Let’s create a dedicated user called node that will own all things n8n. This keeps permissions tidy and makes your life easier down the line. I also give it a shell so you can hop into it if you ever need to tinker directly.
sudo adduser --system --group --home /home/node node
sudo usermod -s /bin/bash node
Step 2: Update Your Raspberry Pi
Before we start installing anything, let’s make sure your Pi is up to date. You don’t want to be halfway through an install only to hit weird errors because some package is ancient. Run the update and upgrade commands, grab the latest versions, and breathe easy knowing your Pi is ready.
sudo apt update && sudo apt upgrade -y
Step 3: Install Node.js 20.x and npm
n8n runs on Node.js, so we need a recent version—Node 20 is the sweet spot right now. We’ll remove any old Node.js lurking on your Pi, then pull in the NodeSource version. After that, a quick check of node -v and npm -v and we’re good. You’re officially ready for n8n
# Remove old Node.js versions if any
sudo apt remove -y nodejs
sudo apt purge -y nodejs
# Install Node.js 20.x
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs=20.19.0-1nodesource1
# Verify installation
node -v # should show v20.19 or newer
npm -v
Step 4: Install n8n Globally
Now for the moment you’ve been waiting for—installing n8n itself. With a single command, it gets installed globally on your Raspberry Pi, which means you can run it from anywhere without worrying about paths or directories. If you’re using a Raspberry Pi 3, be prepared to be patient; npm installs can take a little time on these older ARM boards, sometimes 5–10 minutes depending on your setup. Grab a coffee, stretch your legs, or do a little victory dance while it works. During the install, you may notice a few warnings about “bad engines” or minor dependency mismatches—this is completely normal and nothing to worry about. With Node.js 20.x, n8n will run perfectly, and once the installation finishes, you can check that everything worked by running n8n --version to see the installed version. With that done, your Pi is officially ready to start automating tasks like a tiny, efficient workflow powerhouse.
sudo npm install -g n8n
n8n --version
Step 5: Install SQLite3
By default, n8n uses SQLite. If the SQLite package isn’t installed, n8n will fail to start. Install it globally so your systemd service can access it:
sudo npm install -g sqlite3
You can verify it with:
npm list -g sqlite3
Step 6: Create SSL Certs Directory and Add Certificates
Now that n8n is installed, configured, and running as a systemd service, it’s time to see it in action. You can open your browser and navigate to your Raspberry Pi’s local IP address, or, if you prefer remote access, use a No-IP address that gets updated automatically by your router. If you want to connect n8n to services that use OAuth—like Google, Twitter, or other APIs—you’ll also need to make sure your chosen port (5678, in this setup) is properly forwarded through your firewall and router. This ensures secure authentication flows can complete successfully. Thanks to the SSL certificates you configured (cert.pem and key.pem), your connection is encrypted and secure. From here, you can log in (or skip authentication if you disabled it locally) and start building automations immediately. The web interface is where the magic happens: you can monitor triggers, connect APIs, automate repetitive tasks, and watch your Raspberry Pi silently handle everything in the background. At this point, your Pi has officially leveled up—it’s a compact, efficient automation server that’s always on and ready to make your life easier.
$ sudo mkdir -p /home/node/certs
$ sudo chown node:node /home/node/certs
$ sudo chmod 700 /home/node/certs
# Copy SSL certificates
$ sudo cp [path]/cert.pem /home/node/certs/
$ sudo cp [path]/key.pem /home/node/certs/
# Set permissions
$ sudo chown node:node /home/node/certs/cert.pem
$ sudo chown node:node /home/node/certs/key.pem
$ sudo chmod 600 /home/node/certs/cert.pem
$ sudo chmod 600 /home/node/certs/key.pem
Step 7: Create systemd Service for n8n
Running n8n manually is fine for testing, but if you want it to start automatically whenever your Raspberry Pi boots—and run quietly in the background without you having to type a command every time—you need a systemd service. This step sets that up. You’ll create a new service file where you specify the node user, the working directory, and all the environment variables n8n needs, including your hostname, port 5678, HTTPS protocol, and the paths to your SSL certificates. Once this file is saved, systemd knows how to manage n8n like a proper service: it will automatically restart if anything goes wrong, and it will start on boot so your automations are always running. Think of this as giving n8n a permanent home on your Pi where it quietly does its job without bothering you.
sudo nano /etc/systemd/system/n8n.service
Paste the following content:
[Unit]
Description=n8n Automation Tool
After=network.target
[Service]
ExecStart=/usr/bin/n8n
Restart=always
User=node
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/node/
# SSL + Hostname
Environment=N8N_BASIC_AUTH_ACTIVE=false
Environment=N8N_HOST=<HOSTNAME>
Environment=N8N_PORT=5678
Environment=N8N_PROTOCOL=https
Environment=N8N_SSL_CERT=/home/node/certs/cert.pem
Environment=N8N_SSL_KEY=/home/node/certs/key.pem
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl enable n8n
$ sudo systemctl start n8n
$ sudo systemctl status n8n
Step 8: Access the n8n Web Interface
Now that n8n is installed, configured, and running as a systemd service, it’s time to see it in action. You can open your browser and navigate to your Raspberry Pi’s local IP address, or, if you prefer remote access, use a No-IP address that gets updated automatically by your router. If you want to connect n8n to services that use OAuth—like Google, Twitter, or other APIs—you’ll also need to make sure your chosen port (5678, in this setup) is properly forwarded through your firewall and router. This allows secure authentication flows to complete successfully. Thanks to the SSL certificates you set up earlier, the connection remains encrypted and secure. From here, you can log in (or skip authentication if you disabled it locally) and start building automations immediately. The web interface is where the magic happens: you can monitor triggers, connect APIs, automate repetitive tasks, and watch your Raspberry Pi silently handle everything in the background. At this point, your Pi has officially leveled up—it’s a compact, efficient automation server that’s always on and ready to make your life easier.
https://<HOSTNAME>:5678
And there you have it—your Raspberry Pi is now a fully capable automation hub running n8n, complete with SSL security, systemd service management, and optional dynamic DNS access. Once it’s set up, your Pi quietly handles workflows in the background, freeing you from repetitive tasks and giving you more control over your data. Whether you’re connecting to APIs, monitoring databases, or experimenting with automations, this setup ensures your workflows are reliable, secure, and always available. So go ahead—start building, testing, and automating. Your Pi has officially leveled up, and the possibilities are only limited by your imagination.
Sources
- Node.js Installation on Raspberry Pi – NodeSource
- n8n Documentation: Installing n8n – n8n.io
- Setting Up n8n with Systemd on Raspberry Pi – n8n Community
- SQLite3 Installation for Node.js – npm Documentation
- Raspberry Pi Dynamic DNS Setup – No-IP Knowledge Base
- Raspberry Pi Firewall and Port Forwarding Guide – RaspberryPi.com Documentation
- SSL Certificates for Local Servers – Let’s Encrypt Documentation
Disclaimer:
The views and opinions expressed in this post are solely those of the author. The information provided is based on personal research, experience, and understanding of the subject matter at the time of writing. Readers should consult relevant experts or authorities for specific guidance related to their unique situations.
