Node-RED Installation Guide for Windows, Linux, and Raspberry Pi

Introduction

We have gone through introduction to raspberry pi and and basic setup steps in previous blog. Great many automation projects can be built using this SBC. But, main issue with it is not knowing programming languages like Java, python, C / C++ / C#. This is the point where we start loosing interest . So to take care of that, we are going to look into 'Node-RED', an graphically programming tool.

Node-RED is a low-code programming platform for event-driven applications. It is built on Node.js and uses a graphical flow editor to create flows that connect nodes together. Nodes can be used to perform a variety of tasks, such as sending and receiving messages, interacting with devices, and processing data.

Node-RED is a popular choice for developing IoT applications, but it can also be used for other types of applications, such as web applications, data pipelines, and workflow automation.

This blog post will guide you through the steps to install Node-RED on Windows, Linux, and Raspberry Pi.

Prerequisites

Before installing Node-RED, you will need to have the following installed on your system:

  • Node.js version 14 or higher
  • npm
  • Git (optional)

Installing Node-RED on Windows

To install Node-RED on Windows, follow these steps:

  1. Download and install Node.js from the Node.js website.
  2. Open a command prompt window.
  3. Navigate to the directory where you want to install Node-RED.
  4. Run the following command:

npm install -g --unsafe-perm node-red
  1. Once the installation is complete, you can start Node-RED by running the following command:
node-red

Installing Node-RED on Linux

To install Node-RED on Linux, follow these steps:

  1. Open a terminal window.
  2. Update your package manager:
sudo apt update
  1. Install Node.js and npm:
sudo apt install nodejs npm
  1. Navigate to the directory where you want to install Node-RED.
  2. Run the following command:
npm install -g node-red
  1. Once the installation is complete, you can start Node-RED by running the following command:
node-red

Installing Node-RED on Raspberry Pi

To install Node-RED on Raspberry Pi, follow these steps:

  1. Open a terminal window.
  2. Update your package manager:
sudo apt update
  1. Install Node.js and npm:
sudo apt install nodejs npm
  1. Navigate to the directory where you want to install Node-RED.
  2. Run the following command:
npm install -g node-red
  1. Once the installation is complete, you can start Node-RED by running the following command:
node-red

Starting Node-RED at boot

If you want Node-RED to start automatically when your system boots, you can follow these steps:

On Raspberry Pi:

  1. Create a new text file and name it node-red.service.
  2. Paste the following text into the file:
[Unit]
Description=Node-RED
After=network.target

[Service]
Type=simple
User=pi
ExecStart=/usr/bin/node-red
Restart=always

[Install]
WantedBy=multi-user.target
  1. Save the file and close it.
  2. Copy the file to the /etc/systemd/system/ directory:
sudo cp node-red.service /etc/systemd/system/
  1. Reload the systemd daemon:
sudo systemctl daemon-reload
  1. Enable the Node-RED service:
sudo systemctl enable node-red.service
  1. Start the Node-RED service:
sudo systemctl start node-red.service

On Linux:

  1. Create a new text file and name it node-red.service.
  2. Paste the following text into the file:
[Unit]
Description=Node-RED
After=network.target

[Service]
Type=simple
User=pi
ExecStart=/usr/bin/node-red
Restart=always

[Install]
WantedBy=multi-user.target
  1. Save the file and close it.
  2. Copy the file to the /lib/systemd/system/ directory:
sudo cp node-red.service /lib/systemd/system/
  1. Reload the systemd daemon:
sudo systemctl daemon-reload
  1. Enable the Node-RED service:
sudo systemctl enable node-red.service
  1. Start the Node-RED service:
sudo systemctl start node-red.service

In this blog post, we have shown you how to install and use Node-RED on the Raspberry Pi. Node-RED is a powerful tool that can be used to develop a variety of automation projects, without the need to write any code.

In our next blog post, we will build a live project on Node-RED. We will show you how to use Node-RED to connect to a device, send and receive messages, and process data.


We hope you will join us for our next blog post!


What kind of automation projects would you like to see us build on Node-RED? Let us know in the comments below!

Previous Post Next Post

Contact Form