{"id":7709,"date":"2024-07-22T16:09:17","date_gmt":"2024-07-22T23:09:17","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=7709"},"modified":"2024-07-22T16:09:17","modified_gmt":"2024-07-22T23:09:17","slug":"install-node-red-linux","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/install-node-red-linux\/","title":{"rendered":"How to Install Node RED Linux for Visual Programming"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2024\/07\/Technician-communicating-fastest-install-Node-RED-Linux-commands-whilst-explaining-what-is-node-red-300x300.jpg\" alt=\"Technician communicating fastest install Node RED Linux commands whilst explaining what is node red\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>As we look to improve development of our javascript apps at <a href=\"https:\/\/ioflood.com\/\">IOFLOOD<\/a> the Node-RED programming tool came to our attention. As we learned what is Node-RED, it became clear that this tool is ideal for easy integration of IoT devices and service. Today&#8217;s article was crafted to help our clients deploy a robust tool for developing and managing their IoT solutions on <a href=\"https:\/\/ioflood.com\/phoenix-dedicated-servers.php\">Dedicated bare metal servers<\/a>.<\/p>\n<p><strong>In this guide, we will navigate the processes to install Node RED Linux for your dedicated server.<\/strong> We will provide you with installation instructions for APT-based distributions like Debian and Ubuntu, as well as YUM-based distributions like CentOS and AlmaLinux. We&#8217;ll also delve into more advanced topics like compiling Node-RED from source, installing a specific version, and finally, how to use Node-RED and verify that the correct version is installed.<\/p>\n<p>So, let&#8217;s dive in and start installing Node-RED on your Linux system!<\/p>\n<h2>TL;DR: How Do I Install Node RED Linux?<\/h2>\n<blockquote><p>\n  The simplest way to install Node-RED on Linux is by installing Node.JS and NPM with, <code>sudo apt update<\/code>, <code>sudo apt install nodejs &amp;&amp; sudo apt install npm<\/code>, then install Node-RED via NPM, <code>sudo npm install -g --unsafe-perm node-red<\/code>. Alternatively, you can also use the following Linux installers:\n<\/p><\/blockquote>\n<pre><code class=\"language-bash line-numbers\">#For Debian\/Ubuntu\nbash &lt;(curl -sL https:\/\/raw.githubusercontent.com\/node-red\/linux-installers\/master\/deb\/update-nodejs-and-nodered)\nsudo apt install build-essential\n\n# For Red Hat\/Centos\nbash &lt;(curl -sL https:\/\/raw.githubusercontent.com\/node-red\/linux-installers\/master\/rpm\/update-nodejs-and-nodered)\n<\/code><\/pre>\n<p>This command will download a script from the official Node-RED repository and execute it. This script will update Node.js to the latest stable version and install Node-RED.<\/p>\n<p>But this is just the beginning. Node-RED installation on Linux offers much more flexibility and options. Continue reading for a more detailed guide, advanced installation methods, and troubleshooting tips.<\/p>\n<h2>Get Started: Node Red Tutorial<\/h2>\n<p>Node-RED is a flow-based programming tool for wiring together hardware devices, APIs, and online services. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette. Flows can be then deployed to the runtime in a single click. Whether you&#8217;re a hobbyist or a professional developer, Node-RED offers a range of features that can enhance your application development process.<\/p>\n<h3>Install Node RED Linux with APT<\/h3>\n<p>For distributions like Debian or Ubuntu, you can install NodeJS and NPM using the APT package manager. Here&#8217;s how:<\/p>\n<pre><code class=\"language-bash line-numbers\">sudo apt-get install nodejs npm\nsudo npm install -g --unsafe-perm node-red\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command will first update your package lists and then install Node-RED.<\/p>\n<h3>Install Node RED Linux with YUM<\/h3>\n<p>For YUM-based distributions like CentOS or AlmaLinux, you can install Nodejs and NPM using the YUM package manager. Here&#8217;s the command you need to run:<\/p>\n<pre><code class=\"language-bash line-numbers\">sudo yu,install nodejs npm\nsudo npm install -g --unsafe-perm node-red\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command will first update your system, and then install Node-RED.<\/p>\n<p>Remember, these are just the basic installation methods. There are more advanced methods available, which we will discuss later in this guide.<\/p>\n<h2>Install Node RED Linux from Source<\/h2>\n<p>For more control over the installation process, you can install Node-RED from source. This method requires more steps and familiarity with the command line, but it gives you the flexibility to install specific versions of Node-RED.<\/p>\n<pre><code class=\"language-bash line-numbers\"># Install Node.js and Git for your specific Linux Version)\n# Then install grunt-cli interface\nsudo npm install -g grunt-cli\n\n# Clone the Node-RED repository\ngit clone https:\/\/github.com\/node-red\/node-red.git\ncd node-red\ngit checkout master\n\n# Install the Node-RED dependencies\nnpm install\n\n# Build the code\ngrunt build\n\n# Start Node Red\nnpm start\n\n<\/code><\/pre>\n<h2>Install Specific Versions of Node-RED<\/h2>\n<p>Different versions of Node-RED may offer specific features or compatibility with certain systems. You can install a specific version from source or using package managers.<\/p>\n<h3>From Source<\/h3>\n<p>To install a specific version from source, you need to check out the corresponding Git tag before building the code. For example, to install Node-RED version 1.2.9:<\/p>\n<pre><code class=\"language-bash line-numbers\">git checkout 1.2.9\nnpm install\ngrunt build\nnpm start\n<\/code><\/pre>\n<h3>Version Comparison<\/h3>\n<table>\n<thead>\n<tr>\n<th>Version<\/th>\n<th>Key Features<\/th>\n<th>Compatibility<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1.0.0<\/td>\n<td>Initial stable release<\/td>\n<td>All supported platforms<\/td>\n<\/tr>\n<tr>\n<td>1.2.9<\/td>\n<td>Improved editor features<\/td>\n<td>All supported platforms<\/td>\n<\/tr>\n<tr>\n<td>2.0.0<\/td>\n<td>Introduction of flow debugger<\/td>\n<td>Node.js 10.x and later<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Basic Node RED Use and Verification<\/h2>\n<p>After installing Node-RED, you can start it by running the <code>node-red<\/code> command. You should see output indicating that Node-RED is starting:<\/p>\n<pre><code class=\"language-bash line-numbers\">node-red\n\n# Output:\n# Welcome to Node-RED\n# ...\n# [Expected output from command]\n<\/code><\/pre>\n<p>To verify that Node-RED is installed correctly, you can check the version:<\/p>\n<pre><code class=\"language-bash line-numbers\">node-red --version\n\n# Output:\n# Node-RED version: v1.2.9\n# ...\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command should display the installed version of Node-RED.<\/p>\n<h2>Alternate Node RED Install Methods<\/h2>\n<p>While we have covered the standard and advanced methods of installing Node-RED on Linux, there are alternative approaches that cater to specific needs or environments. Let&#8217;s explore these methods and understand their benefits, potential drawbacks, and use-cases.<\/p>\n<h3>Install Node-RED Linux with Docker<\/h3>\n<p>Docker provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries. To install Node-RED using Docker, you can pull the official Node-RED Docker image. Here&#8217;s how:<\/p>\n<pre><code class=\"language-bash line-numbers\"># Pull the Node-RED Docker image\ndocker pull nodered\/node-red\n\n# Run Node-RED in a Docker container\ndocker run -it -p 1880:1880 --name mynodered nodered\/node-red\n<\/code><\/pre>\n<p>This approach isolates Node-RED from your system, reducing potential conflicts with other software. However, it requires Docker to be installed and may consume more resources than a native installation.<\/p>\n<h3>Install Node-RED Linux with Snap<\/h3>\n<p>Snap is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel. To install Node-RED with Snap, use the following command:<\/p>\n<pre><code class=\"language-bash line-numbers\"># Install Node-RED with Snap\nsudo snap install node-red\n<\/code><\/pre>\n<p>Snap packages are self-contained and include all dependencies needed to run the application. This makes them easier to install and update, but they may consume more disk space than native packages.<\/p>\n<h3>Install Node-RED Linux with NPM<\/h3>\n<p>NPM is the default package manager for Node.js. If you have Node.js installed, you can use NPM to install Node-RED. Here&#8217;s the command:<\/p>\n<pre><code class=\"language-bash line-numbers\"># Install Node-RED with NPM\nsudo npm install -g --unsafe-perm node-red\n<\/code><\/pre>\n<p>This approach allows you to install Node-RED globally with NPM. However, it may require additional steps to set up Node.js and NPM.<\/p>\n<h3>Installation Method Comparison<\/h3>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Advantages<\/th>\n<th>Disadvantages<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Docker<\/td>\n<td>Isolation, Portability<\/td>\n<td>Requires Docker, More resources<\/td>\n<\/tr>\n<tr>\n<td>Snap<\/td>\n<td>Easy to install and update<\/td>\n<td>More disk space<\/td>\n<\/tr>\n<tr>\n<td>NPM<\/td>\n<td>Uses existing Node.js setup<\/td>\n<td>Requires Node.js and NPM setup<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Each of these methods has its own advantages and considerations. You should choose the one that best suits your needs and environment.<\/p>\n<h2>Troubleshooting Node-RED Install<\/h2>\n<p>While installing Node-RED on Linux can be a straightforward process, you may encounter some issues. Let&#8217;s discuss some common challenges and their solutions to ensure a smooth installation experience.<\/p>\n<h3>Issue: Permission Denied<\/h3>\n<p>Sometimes, you might encounter a &#8216;Permission Denied&#8217; error while installing Node-RED. This usually happens due to lack of administrative privileges. To resolve this, you can use the <code>sudo<\/code> command:<\/p>\n<pre><code class=\"language-bash line-numbers\">sudo npm install -g --unsafe-perm node-red\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command runs the installation with root privileges, bypassing the permission issues.<\/p>\n<h3>Issue: Outdated Node.js Version<\/h3>\n<p>Node-RED requires a specific version of Node.js. If your Node.js version is outdated, you might face compatibility issues. You can update Node.js using the Node Version Manager (NVM):<\/p>\n<pre><code class=\"language-bash line-numbers\">nvm install stable\nnvm use stable\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command installs and uses the latest stable version of Node.js.<\/p>\n<h3>Issue: Port Already in Use<\/h3>\n<p>Node-RED runs on a specific port (default is 1880). If this port is already in use, Node-RED cannot start. To solve this, you can change the port in the Node-RED settings file or stop the application using the port.<\/p>\n<pre><code class=\"language-bash line-numbers\"># Change the port in settings.js\n\nsed -i 's\/1880\/1881\/g' ~\/.node-red\/settings.js\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command changes the default port from 1880 to 1881 in the settings file.<\/p>\n<h3>Issue: Unable to Access Node-RED UI<\/h3>\n<p>If you can&#8217;t access the Node-RED user interface after installation, it might be due to firewall settings. You can allow access to the Node-RED port using the <code>ufw<\/code> firewall:<\/p>\n<pre><code class=\"language-bash line-numbers\">sudo ufw allow 1880\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command allows incoming connections to port 1880, enabling access to the Node-RED UI.<\/p>\n<p>Remember, troubleshooting is a vital part of any installation process. Understanding potential issues and their solutions can save you valuable time and effort.<\/p>\n<h2>So, What is Node-Red?<\/h2>\n<p>Node-RED is a programming tool for connecting hardware devices, APIs, and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single click.<\/p>\n<h3>Node-RED: A Powerful Tool for Developers<\/h3>\n<p>Node-RED is built on Node.js, taking full advantage of its event-driven, non-blocking model. This makes it ideal to run at the edge of the network on low-cost hardware such as the Raspberry Pi as well as in the cloud.<\/p>\n<pre><code class=\"language-bash line-numbers\"># Start Node-RED\n\nnode-red start\n\n# Output:\n# Welcome to Node-RED\n# ===================\n\n# [Expected output from command]\n<\/code><\/pre>\n<p>Running the <code>node-red start<\/code> command starts the Node-RED process. You should see a welcome message indicating that Node-RED has started successfully.<\/p>\n<h3>The Benefits of Using Node-RED<\/h3>\n<p>With Node-RED, you can create complex logic by simply wiring together nodes in a &#8216;flow&#8217;. These flows are stored using JSON, which can be easily imported and exported for sharing with others. This visual approach to programming is perfect for novices and experts alike.<\/p>\n<p>Node-RED can be run on a Raspberry Pi and other low-cost hardware. It can also be run in the cloud, making it a versatile tool for IoT projects and real-time data collection and analysis.<\/p>\n<h3>Key Features of Node-RED<\/h3>\n<p>Node-RED offers a wide array of features that make it a powerful tool for developers:<\/p>\n<ul>\n<li><strong>Flow-Based Programming:<\/strong> Node-RED provides a visual interface for flow-based programming, making it easy to wire together events and devices for the Internet of Things.<\/li>\n<li><strong>Built on Node.js:<\/strong> Node-RED takes full advantage of the event-driven, non-blocking model of Node.js, making it ideal for real-time applications.<\/li>\n<li><strong>Social Development:<\/strong> Node-RED features a built-in library that allows you to share useful functions and flows with others.<\/li>\n<li><strong>Browser-Based Editor:<\/strong> Node-RED&#8217;s lightweight, browser-based editor allows you to create new functions using JavaScript, handle HTTP requests and access APIs.<\/li>\n<li><strong>A Wide Range of Nodes:<\/strong> Node-RED comes with a set of core nodes to handle basic functions like function, HTTP, and delay. The palette can be easily extended by installing new nodes created by the community.<\/li>\n<\/ul>\n<p>Understanding the fundamentals of Node-RED and how it fits into application development is key to leveraging its full potential.<\/p>\n<h2>Practical Uses of Node-RED<\/h2>\n<p>Node-RED&#8217;s utility goes beyond individual application development. It&#8217;s a powerful tool that can be integrated into larger projects, making it a valuable addition to any developer&#8217;s toolkit.<\/p>\n<h3>Integrating Node-RED with Other Tools<\/h3>\n<p>Node-RED can be used in conjunction with other tools to create comprehensive solutions. For instance, you can use Node-RED with MQTT, a lightweight messaging protocol for small sensors and mobile devices. This combination is particularly powerful for IoT applications.<\/p>\n<pre><code class=\"language-bash line-numbers\"># Install MQTT node in Node-RED\n\nnpm install node-red-contrib-mqtt-broker\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command installs the MQTT node in Node-RED, allowing you to use MQTT within your Node-RED flows.<\/p>\n<h3>Node-RED and Node.js: A Powerful Duo<\/h3>\n<p>Node-RED is built on Node.js, and the two can be used together to create powerful web applications. Node.js can handle the back-end, while Node-RED can be used for the front-end, creating the user interface and handling user interactions.<\/p>\n<pre><code class=\"language-bash line-numbers\"># Install Node.js HTTP node in Node-RED\n\nnpm install node-red-node-http\n\n# Output:\n# [Expected output from command]\n<\/code><\/pre>\n<p>This command installs the Node.js HTTP node in Node-RED, allowing you to handle HTTP requests within your Node-RED flows.<\/p>\n<h3>To Continue Learning What is Node Red<\/h3>\n<p>To further enhance your Node-RED skills, consider exploring these resources:<\/p>\n<ol>\n<li><a href=\"https:\/\/nodered.org\/about\/#flow-based-programming\" target=\"_blank\" rel=\"noopener\">What is Node Red and Flow Based Programming<\/a>: Explore the visual tool for wiring together devices, APIs, and online services.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/node-red\/cookbook.nodered.org\/wiki\" target=\"_blank\" rel=\"noopener\">Install Node RED Guide on GitHub<\/a>: This guide provides a set of recipes to help you learn Node-RED, created by the community.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/nodered.org\/docs\/tutorials\/\" target=\"_blank\" rel=\"noopener\">Official Node Red Tutorial<\/a>: Dives into Node-RED basics and helps you create a simple application.<\/p>\n<\/li>\n<\/ol>\n<p>These resources are a great starting point for deepening your understanding of Node-RED and its capabilities.<\/p>\n<h2>Recap: How to Install Node RED Linux<\/h2>\n<p>In this comprehensive guide, we&#8217;ve navigated the process of installing Node-RED on Linux. We&#8217;ve explored various methods, each catering to different levels of expertise and specific needs.<\/p>\n<p>We began with the basics, learning how to install Node-RED using standard package managers like APT, YUM, and DNF. We then delved into advanced methods, such as installing Node-RED from source and installing specific versions. Finally, we explored alternative approaches like Docker, Snap, and NPM, catering to specific environments and needs.<\/p>\n<p>Along the way, we tackled common challenges that you might encounter during Node-RED installation, such as &#8216;Permission Denied&#8217; errors, outdated Node.js versions, ports already in use, and difficulties accessing the Node-RED UI. For each issue, we provided solutions and workarounds to ensure a smooth installation experience.<\/p>\n<p>Here&#8217;s a quick comparison of the methods we&#8217;ve discussed:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Advantages<\/th>\n<th>Considerations<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Standard (APT, YUM, DNF)<\/td>\n<td>Easy to use, Suitable for beginners<\/td>\n<td>May require additional steps for specific versions<\/td>\n<\/tr>\n<tr>\n<td>Advanced (Source)<\/td>\n<td>More control, Specific version installation<\/td>\n<td>Requires familiarity with command line<\/td>\n<\/tr>\n<tr>\n<td>Alternative (Docker, Snap, NPM)<\/td>\n<td>Specific environment needs, Isolation (Docker)<\/td>\n<td>Requires additional setup (Docker, NPM), More disk space (Snap)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re just starting out with Node-RED or you&#8217;re looking to level up your installation skills, we hope this guide has given you a deeper understanding of Node-RED installation on Linux and its various methods.<\/p>\n<p>With its powerful toolset and flexibility, Node-RED is a valuable addition to any developer&#8217;s toolkit. Now, you&#8217;re well equipped to install Node-RED on Linux and harness its full potential. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we look to improve development of our javascript apps at IOFLOOD the Node-RED programming tool came to our attention. As we learned what is Node-RED, it became clear that this tool is ideal for easy integration of IoT devices and service. Today&#8217;s article was crafted to help our clients deploy a robust tool for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":22263,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-7709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","cat-3-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/7709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=7709"}],"version-history":[{"count":20,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/7709\/revisions"}],"predecessor-version":[{"id":22571,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/7709\/revisions\/22571"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/22263"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=7709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=7709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=7709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}