{"id":922,"date":"2023-10-03T11:25:16","date_gmt":"2023-10-03T09:25:16","guid":{"rendered":"https:\/\/sebabu.landau-software.de\/?p=922"},"modified":"2023-10-03T11:26:57","modified_gmt":"2023-10-03T09:26:57","slug":"node-red-installation-update","status":"publish","type":"post","link":"https:\/\/sebabu.landau-software.de\/?p=922","title":{"rendered":"Node Red Installation \/ Update"},"content":{"rendered":"\n<!--more-->\n\n\n\n<p>Quelle: <a href=\"https:\/\/nodered.org\/docs\/getting-started\/raspberrypi\">Nodered.org<\/a><\/p>\n\n\n\n<p>Stand: 03.10.2023<\/p>\n\n\n\n<p>Erfolgreich genutzt<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Running on Raspberry Pi<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h3>\n\n\n\n<p>If you are using Raspberry Pi OS, Bullseye is the currently supported version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"installing-and-upgrading-node-red\">Installing and Upgrading Node-RED<\/h3>\n\n\n\n<p>We provide a script to install Node.js, npm and Node-RED onto a Raspberry Pi. The script can also be used to upgrade an existing install when a new release is available.<\/p>\n\n\n\n<p>Running the following command will download and run the script. If you want to review the contents of the script first, you can view it&nbsp;<a href=\"https:\/\/raw.githubusercontent.com\/node-red\/linux-installers\/master\/deb\/update-nodejs-and-nodered\">on Github<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bash &lt;(curl -sL https:\/\/raw.githubusercontent.com\/node-red\/linux-installers\/master\/deb\/update-nodejs-and-nodered)\n<\/code><\/pre>\n\n\n\n<p>There are extra parameters you can pass to the script. Add&nbsp;<code>--help<\/code>&nbsp;to the end of the above command to see them.<\/p>\n\n\n\n<p>This script will work on any&nbsp;<strong>Debian-based<\/strong>&nbsp;operating system, including&nbsp;<strong>Ubuntu<\/strong>&nbsp;and&nbsp;<strong>Diet-Pi<\/strong>. You may need to run&nbsp;<code>sudo apt install build-essential git curl<\/code>&nbsp;first to ensure npm is able to fetch and build any binary modules it needs to install.<\/p>\n\n\n\n<p>This script will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>remove the existing version of Node-RED if present.<\/li>\n\n\n\n<li>if it detects Node.js is already installed, it will ensure it is at least v14. If less than v14 it will stop and let the user decide whether to stay with Node-RED version 1 &#8211; or upgrade Nodejs to a more recent LTS version. If nothing is found it will install the Node.js 16 LTS release using the&nbsp;<a href=\"https:\/\/github.com\/nodesource\/distributions\/blob\/master\/README.md\">NodeSource<\/a>&nbsp;package.<\/li>\n\n\n\n<li>install the latest version of Node-RED using npm.<\/li>\n\n\n\n<li>optionally install a collection of useful Pi-specific nodes.<\/li>\n\n\n\n<li>setup Node-RED to run as a service and provide a set of commands to work with the service.<\/li>\n<\/ul>\n\n\n\n<p>Node-RED has also been packaged for the Raspberry Pi OS repositories and appears in their list of &#8218;Recommended Software&#8216;. This allows it to be installed using&nbsp;<code>apt-get install nodered<\/code>&nbsp;and includes the Raspberry Pi OS-packaged version of Node.js, but&nbsp;<em>does not<\/em>&nbsp;include&nbsp;<code>npm<\/code>.<\/p>\n\n\n\n<p><strong>Note<\/strong>: at this time the default node.js included with RaspiOS Bullseye is still v12. This means that the latest Node-RED version that can be installed is the 2.x branch. While using these packages is convenient at first, we&nbsp;<strong>strongly recommend<\/strong>&nbsp;using the install script above instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"running-locally\">Running locally<\/h3>\n\n\n\n<p>As with&nbsp;<a href=\"https:\/\/nodered.org\/docs\/getting-started\/local\">running Node-RED locally<\/a>, you can use the&nbsp;<code>node-red<\/code>&nbsp;command to run Node-RED in a terminal. It can then be stopped by pressing&nbsp;<code>Ctrl-C<\/code>&nbsp;or by closing the terminal window.<\/p>\n\n\n\n<p>Due to the limited memory of the Raspberry Pi, you will need to start Node-RED with an additional argument to tell the underlying Node.js process to free up unused memory sooner than it would otherwise.<\/p>\n\n\n\n<p>To do this, you should use the alternative&nbsp;<code>node-red-pi<\/code>&nbsp;command and pass in the&nbsp;<code>max-old-space-size<\/code>&nbsp;argument.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node-red-pi --max-old-space-size=256\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"running-as-a-service\">Running as a service<\/h3>\n\n\n\n<p>The install script for the Pi also sets it up to run as a service. This means it can run in the background and be enabled to automatically start on boot.<\/p>\n\n\n\n<p>The following commands are provided to work with the service:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>node-red-start<\/code>&nbsp;&#8211; this starts the Node-RED service and displays its log output. Pressing&nbsp;<code>Ctrl-C<\/code>&nbsp;or closing the window does&nbsp;<em>not<\/em>&nbsp;stop the service; it keeps running in the background<\/li>\n\n\n\n<li><code>node-red-stop<\/code>&nbsp;&#8211; this stops the Node-RED service<\/li>\n\n\n\n<li><code>node-red-restart<\/code>&nbsp;&#8211; this stops and restarts the Node-RED service<\/li>\n\n\n\n<li><code>node-red-log<\/code>&nbsp;&#8211; this displays the log output of the service<\/li>\n<\/ul>\n\n\n\n<p>You can also start the Node-RED service on the Raspberry Pi OS Desktop by selecting the&nbsp;<code>Menu -&gt; Programming -&gt; Node-RED<\/code>&nbsp;menu option.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"autostart-on-boot\">Autostart on boot<\/h3>\n\n\n\n<p>If you want Node-RED to run when the Pi is turned on, or re-booted, you can enable the service to autostart by running the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable nodered.service\n<\/code><\/pre>\n\n\n\n<p>To disable the service, run the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl disable nodered.service\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"opening-the-editor\">Opening the editor<\/h3>\n\n\n\n<p>Once Node-RED is running you can access the editor in a browser.<\/p>\n\n\n\n<p>If you are using the browser on the Pi desktop, you can open the address:&nbsp;<a href=\"http:\/\/localhost:1880\/\">http:\/\/localhost:1880<\/a>.<\/p>\n\n\n\n<p>We recommend using a browser outside of the PI and pointing it at Node-RED running on the Pi. However you can use the built in browser and if so we recommend Chromium or Firefox-ESR and&nbsp;<em>not<\/em>&nbsp;Epiphany<\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<p>When browsing from another machine you should use the hostname or IP-address of the Pi:&nbsp;<code>http:\/\/&lt;hostname&gt;:1880<\/code>. You can find the IP address by running&nbsp;<code>hostname -I<\/code>&nbsp;on the Pi.<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":742,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-node-red"],"_links":{"self":[{"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/posts\/922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=922"}],"version-history":[{"count":2,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions"}],"predecessor-version":[{"id":924,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions\/924"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=\/wp\/v2\/media\/742"}],"wp:attachment":[{"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sebabu.landau-software.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}