Ready to explore Node-RED on Ubuntu? This open-source, flow-based programming tool is a game-changer for IoT projects and automation. With a drag-and-drop interface, it’s perfect for beginners and pros alike, connecting devices, APIs, and services in minutes. This 2025 guide is tailored for Ubuntu 20.04, 22.04, or 24.04, using Node.js LTS (v20.x). In ~10 minutes, you’ll install Node-RED, set it to run automatically, and build fun flows for IoT or automation. Grab a coffee, and let’s create some tech magic!
- Why Choose Node-RED for IoT and Automation?
- 🧰 Prerequisites for Installing Node-RED on Ubuntu
- 🛠️ Step 1: Install Node.js LTS (v20.x) for Node-RED
- 1.1 Remove Old Node.js Versions (If Needed)
- 1.2 Install Node.js LTS (v20.x)
- 1.3 Verify Node.js and npm Installation
- 🚀 Step 2: Install Node-RED on Ubuntu
- ▶️ Step 3: Launch Node-RED and Explore the Flow Editor
- ⚙️ Step 4: Run Node-RED as a System Service
- 🎉 Step 5: Build Fun Node-RED Flows for IoT and Automation
- Flow 1: Hello, World! with Node-RED
- Flow 2: Fetch a Random Chuck Norris Joke
- Flow 3: Time-Tracking Automation
- Bonus: Secure Your Node-RED Setup
- FAQs for Node-RED on Ubuntu 2025
- You’re a Node-RED Pro on Ubuntu!
You may like to check: What is the Future of IoT and Top Trends
Why Choose Node-RED for IoT and Automation?
Node-RED, built on Node.js, is a lightweight, browser-based tool for flow-based programming. It lets you visually connect IoT devices, APIs, and services with minimal coding, making it ideal for Ubuntu users. Whether you’re automating tasks or building smart home systems, Node-RED is your tech playground.
What Makes Node-RED Awesome?
- IoT Powerhouse: Control smart lights, sensors, or Arduino with ease.
- Automation Wizard: Schedule social media posts or monitor server status.
- App Connector: Link services like Twitter, Google Sheets, or MQTT brokers.
- Flexible Platform: Runs on Ubuntu, Raspberry Pi, or cloud servers.
- Open-Source: Started by IBM, now thriving under the OpenJS Foundation.
Real-World Node-RED Use Cases
- Monitor home temperature and send alerts via email or SMS.
- Automate data logging from IoT sensors to a database.
- Build a dashboard to control smart home devices in real-time.
Fun Fact: In 2025, over 2.5 million Node-RED instances are estimated to be running globally, making it a top choice for IoT automation enthusiasts!

Must Read: The Best 30 Node.js Interview Questions and Answers
🧰 Prerequisites for Installing Node-RED on Ubuntu
Before diving in, ensure your setup is ready for Node-RED on Ubuntu 2025:
- Ubuntu System: Version 20.04, 22.04, or 24.04. Verify with:
lsb_release -a
- Sudo Access: Required for installing Node.js and Node-RED. Check with:
sudo -l
- Internet Connection: Needed to download Node.js and Node-RED packages.
- Terminal: Open with Ctrl + Alt + T on Ubuntu.
- Optional: A comfy workspace—maybe some music to vibe with your IoT projects!
Pro Tip: Keep your Ubuntu system updated for a smooth Node-RED setup:
sudo apt update && sudo apt upgrade -y
🛠️ Step 1: Install Node.js LTS (v20.x) for Node-RED
Node-RED relies on Node.js, so we’ll install Node.js LTS (v20.x), the recommended version for 2025. We’ll use NodeSource for a reliable, official installation on Ubuntu.
1.1 Remove Old Node.js Versions (If Needed)
Old Node.js versions can cause compatibility issues with Node-RED. Clean them out:
sudo apt-get remove nodejs npm -y
sudo apt-get autoremove -y
Why? This prevents conflicts with Node-RED’s requirements. Skip if you haven’t installed Node.js before.
1.2 Install Node.js LTS (v20.x)
Run these commands to add NodeSource’s repository and install Node.js:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
What’s Happening?
- curl fetches the NodeSource setup script for Ubuntu.
- apt-get install downloads Node.js and npm (Node’s package manager).
- Expect ~1-2 minutes, depending on your internet speed.
1.3 Verify Node.js and npm Installation
Confirm Node.js and npm are ready for Node-RED:
node -v
# Expected: v20.x.x (e.g., v20.14.0)
npm -v
# Expected: 10.x.x (e.g., 10.8.1)
Troubleshooting:
- No output? Restart your terminal or reboot Ubuntu (sudo reboot).
- Still issues? Run sudo apt update or check your internet connection.
🚀 Step 2: Install Node-RED on Ubuntu
With Node.js set, let’s install Node-RED and start building flows for IoT and automation.
Run:
sudo npm install -g --unsafe-perm node-red
Why –unsafe-perm? It ensures Node-RED installs correctly with sudo, avoiding permission errors on Ubuntu.
How Long? ~1-2 minutes. Node-RED is lightweight (~5MB) but pulls dependencies like Express.js for its web server.
Fun Fact: Node-RED’s browser-based editor leverages Node.js to make flow-based programming intuitive and fast.
▶️ Step 3: Launch Node-RED and Explore the Flow Editor
Let’s start Node-RED and dive into its flow-based programming interface.
Run:
node-red
What Happens? Node-RED starts a server, showing logs like “Server now running at http://127.0.0.1:1880/”.
Open the Node-RED Editor
In your browser (Chrome, Firefox, or Edge), visit:
http://localhost:1880
You’ll see Node-RED’s flow editor:
- Left Sidebar: Nodes like inject (triggers), debug (output), and http request (APIs).
- Canvas: Drag and connect nodes to build IoT or automation flows.
- Right Sidebar: Debug tab for results, plus info and settings.
- Top-Right: Deploy button to save and run flows.
Troubleshooting:
- Can’t access localhost:1880? Try http://127.0.0.1:1880.
- Still stuck? Check if Node-RED is running or if port 1880 is blocked:
sudo netstat -tuln | grep 1880
- Ensure your firewall allows port 1880:
sudo ufw allow 1880
Image Suggestion: Node-RED editor screenshot (Alt text: “Node-RED browser-based flow editor on Ubuntu 2025”).
⚙️ Step 4: Run Node-RED as a System Service
For reliable IoT and automation projects, set Node-RED to run automatically on Ubuntu boot using a systemd service.
4.1 Create a Node-RED Service File
Create a systemd service file:
sudo nano /etc/systemd/system/node-red.service
Paste this:
[Unit]
Description=Node-RED Flow-Based Programming for IoT and Automation
After=network.target
[Service]
ExecStart=/usr/bin/env node-red
Restart=on-failure
User=your_username_here
Environment="NODE_OPTIONS=--max_old_space_size=256"
[Install]
WantedBy=multi-user.target
Customize: Replace your_username_here with your Ubuntu username (check with whoami).
Why NODE_OPTIONS? Limits memory usage, ideal for IoT devices like Raspberry Pi.
Save: Press Ctrl + O, Enter, then Ctrl + X.
4.2 Enable and Start the Service
Activate the Node-RED service:
sudo systemctl daemon-reload
sudo systemctl enable node-red
sudo systemctl start node-red
What’s Happening?
- daemon-reload: Updates Ubuntu’s service configurations.
- enable: Sets Node-RED to start on boot.
- start: Runs Node-RED immediately.
4.3 Verify Service Status
Check if Node-RED is running:
sudo systemctl status node-red
Look for “active (running)” in green. If not, view logs:
journalctl -u node-red -b
Test the editor again at http://localhost:1880.
🎉 Step 5: Build Fun Node-RED Flows for IoT and Automation
Let’s create three simple Node-RED flows to showcase flow-based programming for IoT and automation on Ubuntu.
Flow 1: Hello, World! with Node-RED
Learn the basics of data flow:
- Open http://localhost:1880.
- Drag an Inject node from the left sidebar.
- Drag a Debug node and connect them (draw a line between their dots).
- Double-click the Inject node:
- Set Payload to string.
- Enter Hello, World!.
- Click Deploy (top-right red button).
- Click the Inject node’s button (left square). See “Hello, World!” in the debug tab.
Why Try This? It teaches how Node-RED passes data, a core concept for IoT and automation flows.
Flow 2: Fetch a Random Chuck Norris Joke
Use an API to grab a joke, showing Node-RED’s web capabilities:
1. In Node-RED, click Menu (top-right) > Import.
2. Paste this JSON:
[
{
"id": "a1b2c3d4e5f6",
"type": "inject",
"z": "z1x2y3",
"name": "Get Joke",
"props": [{ "p": "payload" }, { "p": "topic", "vt": "str" }],
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 100,
"wires": [["b2c3d4e5f6"]]
},
{
"id": "b2c3d4e5f6",
"type": "http request",
"z": "z1x2y3",
"name": "Random Joke",
"method": "GET",
"ret": "txt",
"url": "https://api.chucknorris.io/jokes/random",
"tls": "",
"x": 250,
"y": 100,
"wires": [["c3d4e5f6a7"]]
},
{
"id": "c3d4e5f6a7",
"type": "debug",
"z": "z1x2y3",
"name": "Show Joke",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 400,
"y": 100,
"wires": []
}
]
3. Click Import, then Deploy.
4. Click the Inject node’s button. A Chuck Norris joke appears in the debug tab (e.g., “Chuck Norris codes in binary with one hand”).
Why This Works? It demonstrates API integration, key for IoT automation like fetching weather data or controlling devices.
Flow 3: Time-Tracking Automation
Log the time every 10 seconds for automation tasks:
- Drag an Inject node.
- Double-click it:
- Set Repeat to interval.
- Set Every to 10 seconds.
- Set Payload to timestamp.
- Connect to a Debug node.
- Click Deploy. The debug tab shows timestamps every 10 seconds.
Why Try It? Perfect for scheduling IoT tasks, like polling sensors or automating alerts.
Bonus: Secure Your Node-RED Setup
For production IoT and automation projects, secure Node-RED:
- Enable Authentication: Edit ~/.node-red/settings.js to add admin and user passwords.
- Use HTTPS: Configure a reverse proxy (e.g., Nginx) for secure access.
- Firewall Rules: Restrict port 1880 to trusted IPs:
sudo ufw allow from 192.168.1.0/24 to any port 1880
FAQs for Node-RED on Ubuntu 2025
Q: What Node.js versions are compatible with Node-RED in 2025?
A: Node-RED supports Node.js LTS (v18.x or v20.x). Use v20.x for the latest features.
Q: Can I run Node-RED on a Raspberry Pi with Ubuntu?
A: Yes! Follow this guide, as Node-RED is lightweight and perfect for IoT on Raspberry Pi. See Node-RED’s Raspberry Pi guide.
Q: How do I stop Node-RED?
A: For manual runs, press Ctrl + C. For services:
sudo systemctl stop node-red
Q: How do I add custom nodes to Node-RED?
A: In the editor, go to Menu > Manage Palette > Install. Popular nodes:
- node-red-contrib-mqtt: For IoT device communication.
- node-red-node-email: For sending automation emails.
- node-red-dashboard: For building IoT dashboards.
Q: Why does Node-RED crash or not start?
A: Common fixes:
- Ensure 512MB+ free RAM.
- Check port 1880 availability:
sudo netstat -tuln | grep 1880
- View logs:
journalctl -u node-red -b
- Reinstall Node.js if needed.
Q: Can Node-RED run on Ubuntu Server?
A: Yes! This guide works for Ubuntu Server (headless). Access the editor via http://<server-ip>:1880.
Also Check: Quick Overview of EVAL Command On Linux
You’re a Node-RED Pro on Ubuntu!
Congratulations! You’ve installed Node-RED on Ubuntu 2025, set it up to run automatically, and built flows for IoT and automation. You’ve:
- Installed Node.js LTS (v20.x).
- Launched Node-RED’s flow-based editor.
- Created fun flows like a joke API and time tracker.
- Learned to secure and troubleshoot your setup.
What’s Next?
- Add Nodes: Explore node-red-contrib-mqtt for IoT or node-red-dashboard for web interfaces.
- Build Projects: Create a flow to monitor a website’s status and email alerts if it’s down.
- Learn More: Visit Node-RED’s official docs for advanced flow-based programming tips.
Cool Project Idea
Build a Node-RED flow to monitor your home’s temperature via an IoT sensor and tweet updates using node-red-node-twitter. Dive into IoT automation and have fun on Ubuntu!