Install Node-RED on Raspberry Pi

If you are using Raspbian Stretch with Desktop (the full image) Node-RED comes preinstalled on it. On Raspbian Stretch Lite you’ll have to install Node-RED on your own. Although, you also can follow these guide to update your Node-RED version on the full image version of Raspbian.

Install Node-RED on Raspberry Pi

To install Node-RED connect to your Pi over SSH and enter these command to download and execute the official install and update script of Node-RED (this will also update or install NodeJS):

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

The script will ask you two questions:

Are you really sure you want to do this?
Would you like to install the Pi-specific nodes?

Answer both with yes (y)!

After a while you will see this screen:

Install_Node-RED

Commands to start and stop Node-RED and view the log file

You have successfully installed Node-RED on your Pi. Now all you need are the commands to control it:

node-red-start - Start Node-RED
node-red-stop - Stop Node-RED
node-red-log - View the recent log

Enter node-red-start into the shell to start Node-Red.

node-red-start

After starting Node-RED the shell will automatically show you the output of node-red-log. To be able to type new commands enter CTRL+C. Don’t worry, Node-RED is started as a service. You will not kill it by hitting CTRL+C.

You are now able to open Node-RED by entering http://YOUR-IP:1880 to the browser.

Automatically start Node-RED on boot

To automatically start Node-RED when the Pi boots there is only one command necessary:

sudo systemctl enable nodered.service

To disable the autostart of Node-RED enter:

sudo systemctl disable nodered.service

 

Leave a Reply