Running Node-RED locally on your Computer

Introduction to Node-RED Getting started with Node-RED
18 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€67.10
List Price:  €95.86
You save:  €28.76
£55.67
List Price:  £79.54
You save:  £23.86
CA$100.49
List Price:  CA$143.56
You save:  CA$43.07
A$111.96
List Price:  A$159.95
You save:  A$47.99
S$94.87
List Price:  S$135.54
You save:  S$40.66
HK$544.16
List Price:  HK$777.41
You save:  HK$233.24
CHF 62.56
List Price:  CHF 89.37
You save:  CHF 26.81
NOK kr792.29
List Price:  NOK kr1,131.89
You save:  NOK kr339.60
DKK kr500.54
List Price:  DKK kr715.08
You save:  DKK kr214.54
NZ$123.74
List Price:  NZ$176.78
You save:  NZ$53.04
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,330.24
List Price:  ৳11,900.85
You save:  ৳3,570.61
₹5,945.56
List Price:  ₹8,494.03
You save:  ₹2,548.46
RM315.51
List Price:  RM450.75
You save:  RM135.24
₦108,149.19
List Price:  ₦154,505.46
You save:  ₦46,356.27
₨19,403.53
List Price:  ₨27,720.51
You save:  ₨8,316.98
฿2,393.75
List Price:  ฿3,419.79
You save:  ฿1,026.04
₺2,454.67
List Price:  ₺3,506.82
You save:  ₺1,052.15
B$425.95
List Price:  B$608.53
You save:  B$182.58
R1,282.09
List Price:  R1,831.63
You save:  R549.54
Лв131.15
List Price:  Лв187.37
You save:  Лв56.21
₩101,234.93
List Price:  ₩144,627.53
You save:  ₩43,392.60
₪254.67
List Price:  ₪363.83
You save:  ₪109.16
₱4,117.86
List Price:  ₱5,882.91
You save:  ₱1,765.05
¥10,949.58
List Price:  ¥15,642.93
You save:  ¥4,693.35
MX$1,405.49
List Price:  MX$2,007.92
You save:  MX$602.43
QR254.12
List Price:  QR363.05
You save:  QR108.92
P963.49
List Price:  P1,376.48
You save:  P412.98
KSh8,999.72
List Price:  KSh12,857.29
You save:  KSh3,857.57
E£3,561.31
List Price:  E£5,087.81
You save:  E£1,526.49
ብር8,689.79
List Price:  ብር12,414.52
You save:  ብር3,724.72
Kz64,250.82
List Price:  Kz91,790.82
You save:  Kz27,540
CLP$69,143.42
List Price:  CLP$98,780.55
You save:  CLP$29,637.13
CN¥510.67
List Price:  CN¥729.56
You save:  CN¥218.89
RD$4,244.94
List Price:  RD$6,064.47
You save:  RD$1,819.52
DA9,440.04
List Price:  DA13,486.35
You save:  DA4,046.31
FJ$162.13
List Price:  FJ$231.62
You save:  FJ$69.49
Q537.12
List Price:  Q767.35
You save:  Q230.22
GY$14,584.29
List Price:  GY$20,835.60
You save:  GY$6,251.30
ISK kr9,693.35
List Price:  ISK kr13,848.23
You save:  ISK kr4,154.88
DH701.59
List Price:  DH1,002.31
You save:  DH300.72
L1,285.64
List Price:  L1,836.70
You save:  L551.06
ден4,127.89
List Price:  ден5,897.23
You save:  ден1,769.34
MOP$558.06
List Price:  MOP$797.27
You save:  MOP$239.20
N$1,283.39
List Price:  N$1,833.49
You save:  N$550.10
C$2,565.21
List Price:  C$3,664.75
You save:  C$1,099.53
रु9,482.30
List Price:  रु13,546.73
You save:  रु4,064.42
S/259.58
List Price:  S/370.84
You save:  S/111.26
K282.68
List Price:  K403.85
You save:  K121.16
SAR262.90
List Price:  SAR375.59
You save:  SAR112.68
ZK1,929.21
List Price:  ZK2,756.13
You save:  ZK826.92
L333.95
List Price:  L477.10
You save:  L143.14
Kč1,686.22
List Price:  Kč2,408.98
You save:  Kč722.76
Ft27,781.83
List Price:  Ft39,690.03
You save:  Ft11,908.20
SEK kr772.17
List Price:  SEK kr1,103.14
You save:  SEK kr330.97
ARS$71,242.69
List Price:  ARS$101,779.64
You save:  ARS$30,536.94
Bs481.71
List Price:  Bs688.19
You save:  Bs206.47
COP$305,135.87
List Price:  COP$435,927.07
You save:  COP$130,791.20
₡35,171.10
List Price:  ₡50,246.58
You save:  ₡15,075.48
L1,769.55
List Price:  L2,528.04
You save:  L758.48
₲543,563.42
List Price:  ₲776,552.46
You save:  ₲232,989.03
$U3,109.25
List Price:  $U4,441.97
You save:  $U1,332.72
zł286.15
List Price:  zł408.81
You save:  zł122.65
Already have an account? Log In

Transcript

Video 2.3 running node red locally on your computer. In this video, we will learn why you should install Node red on your local machine, how to install and deploy node red on your local computer, be it a Windows or a Mac, and how to secure your node red editor. Now, you may have a Windows machine or a Mac machine, not to worry, we will cover both. First, we look at the installation of node red on Windows. OK, but why should we install Node red on Windows while we have already installed it on IBM, which has way more advantages than the local machine? Well, if you want to run applications in your own server, or if you want to store some data in the database running on your machine, or if you want to run applications on your machine offline Then installing node red on your local machine would be the best way.

Okay, let's start again. Yeah, there are many ways to install it, but we'll go with the simplest way. These instructions are specific to Windows 10, but should also work for Windows seven and Windows Server from 2008 or two. It is not advisable to use versions prior to Windows seven or Windows Server 2008 or two due to lack of current support. We all know that node rate runs on node j s. So the deploy node red on your local machine, we must make sure that we have Node JS. To install Node j s, go to the link I've given in the resources.

Choose the first option LTS or long term support because it's the safest bet. Make sure the downloadable link comes under Windows. Then once the installer has been downloaded the run it to install Node j s, you will be needing local administrator permissions for this. Note that NPM package manager also gets installed along with node j s. Now after the installation completes, close any open command prompts and reopen it to ensure the new environment variables are picked up. Environment Variables are nothing but dynamic objects on a computer, meaning they have an editable value, which is used by one or more software programs on Windows to know what directory to install the files in where to store temporary files and where to find user profile settings. To check if it has been installed, we can do a version check.

Go to the command prompt Again, you can use PowerShell as well, which has an advantage over command prompt because it recognizes the most basic Linux commands type the command node version and NPM version. You should see an output similar to this. Okay, now that you've installed node GS, we can install Node red using the command npm install g unsafe node red Okay, while you can understand npm install Node red What do you think G and unsafe are these are called flags. The G flag is used to install Node red as a global module, which adds the command node dash red to your system path. That is the PATH environment variable now we'll be installing node red. With the G flag enabled.

The unsafe burn flag is used to give root permissions while installing node red. This flag helps in continuing the installation in the event of an error. If you want to know what happens if you install Node red without g flag, which you should, then I have mentioned how to uninstalled node red at the end of this video, so that you can follow the video without any trouble. Check out the link in the resources, which tells you how to upgrade node red and Node JS. Once node red has been installed, and since we've installed node red as a global NPM package, use the command node dash red to start node red. In case you've installed node red without using the G flag, then you can start node red using the command node node underscore modules, backslash node hash rate, backslash red.js.

Run this command within the directory where you ran npm install. The command starts outputting node red logs in the terminal, it might take some time for setting up the node read environment. You know the setup is done. When you see the text started flows on your console. The console stays open and shows the log info of the flows, which provide a lot of information. Like you can see the versions of node red and Node JS installed on your machine.

You can also see the location of important files in Node red, and the log also shows the URL to access the web based editor. Use it to open the web based node read editor. Note that the given URL is 127 dot zero dot zero dot one colon 18. At the port number 1880 is used by note rate, which is a TCP UDP port. The IP address 127 dot zero dot zero dot one corresponds to localhost, which means instead of that URL, you can also use localhost colon 8080 to access the node red editor. One important thing to note is that to keep node rate running, we must keep the terminal open.

You can close the console by pressing Ctrl C. At first boot, the necessary directories and files like settings.gs flow file and use a directory will be created automatically. OK, okay, so what are those files? Exactly? Let me show you We have to go to dot node red, which is a hidden file. And here it is. Of these package dot Jason, and settings.js are the most important files.

I'll teach you about package dot Jason later in this course. settings.js is a settings file, which is the first to run when the node rate starts. This file sets the admin port, user directory, the flow file, etc. If you want to configure node rate, then you must go for this file. This file exports the GS object, which is what is passed through the nodes getting modified at every node. Note that these files will also be present in the IBM Cloud platform in the get repository under the DevOps tool chain.

We look into them later. You can also use your own my settings.js file instead of the default one. If you want to do that, use the switch flag while running the node red start command node dash rate dash s, my settings.js. If my settings.js was the only settings file present inside the dot node red directory, then it will be used by default. The second stage of starting node red involves setting up the user directory, which is when no dread stores all user data like credentials, flow and library data. If you want to have multiple user directories, you can mention the user directory to load in the settings.js file.

By default, the user directory chosen is dot node read the user directory contains The flow file. Okay, next is a flow file, which goes by the name flows underscore server name dot Jason. This file contains all the flows in your node read editor in JSON format for easy important export. This was created the first time you ran node red, and then every time this file gets updated when you deploy a flow the third stage of starting node red is loading flows from the flow file. The flows underscore server name underscore cred dot Jason contains the login data used by some nodes. Great.

There are other ways to manage your flows as well. You can use the project feature in the node rate, which will help you in backing up your flows using the get repository Learn how to do that, check out the resources section. Did you also know that you can run multiple instances of node read on a single machine? How? Well I don't know. But we can figure out how running different instances means that multiple users can use a single application.

Remember the URL we got 127 dot zero dot zero dot one colon 1880. You can see that the port number is 1880 where we can run only one instance of node red. Okay, so if we need to run another instance, we need to have another port number done, but it is not only the port number is it remember I told you about the user directory will the user directory will have the flow file which will contain all your flows So can the user directory be shared among different users? There is no way I'm sharing it with someone. So to avoid conflicts, we will have to have different user directories. So either you can have a different port, and a different user directory for each instance, or create and use a new settings.js file for each instance.

To check out how that works. Look for a link in the resources. Note that this is different from sharing node read with different uses of a computer. Many Node JS modules used by node red are installed nodes have binary components that will need compiling before they will work on Windows. To enable NPM to compile binaries on the Windows platform, install the windows build tools module using the command prompt as an administrator npm install global production windows build tools. Once you install the module, close and open your command prompt window for the changes to take effect, check out the link in the resources, which teaches you how to auto start node red, running on Windows on both.

Okay, now that we have a node red running, and we can access our editor to create and deploy applications, remember that according to the prophecy, the notary running on your machine can easily be hacked. Because out of the box, it is not secure. To prove the prophecy wrong, we need to secure our node red. This can be done in two ways. username or password credential based authentication, authentication against any OAuth or open ID provider, such as Twitter or GitHub. But I'm gonna go with credential based authentication.

Because it is the easiest way, we can authenticate node red platform in three ways, two of which we'll be seeing later. First, we need to secure the node red editor. For that, we need to change the settings.js file. Don't get overwhelmed by the number of code lines in this file. We will not be using much of it, but I'll explain whatever we use as in when necessary. We can secure node red editor by uncommenting, the admin author lines.

Here, you can see that there are already some credentials admin as username and password as a password, except that it is securely hashed using the bcrypt algorithm. The star denotes that the user has full access to the editor. Notice user's property is an array of user objects. This allows you to define multiple users, each of whom can have different permissions. Since everyone knows the password, it has to be changed. Add your username and password, but we have to enter the hash one.

And how can we hash it? Note rate admin comes to save the day. No dread admin is a tool to administer no dread from the command line. It provides a command to create a password hash. To use it, we have to first install it Any guess as to what the command could be? Well, it must have these keywords NPM G, node, red admin and install so let's check npm install g No dread admin.

Bingo. It is getting installed. Great. Okay, let's try the command to generate hash, no dread admin hash pw you have to enter the password to generate the hash. And there it is. Copy and paste it there and save it.

Note that whenever you change node read files, you have to restart it for the changes to take effect. So let's do it. Okay, now hopefully, we have falsified the prophecy. Let's check it to be sure. Fantastic. Now you can run your applications without worrying about your editor getting hacked.

Okay, good. Like I promised before, let me show you how to uninstalled no dread in Windows. is the same as the first command, except that the key word will be uninstalled. Instead of install. Next, you have to clean the cache by using the command NPM cache clean force G and use the command NPM LS g depth is equal to zero to check if all the modules have been uninstalled. Now we can move on to installing node red in Mac, installed Node JS the same way we installed it on Windows, then check if it has been properly installed by checking the version then run the command to install Node red.

The command is similar, but within addition sudo which will give root user access if you are not running as the root user. This command doesn't exist in Windows after installation run node dash red command to start node red, you can access the editor from a web browser. Here, you can see that there are some pre installed nodes for Mac. Anyway, if you want to add more, you can always use the Manage palette option. The dot node red folder is a hidden folder, which cannot be seen in the Mac by default. To view it, go to Macintosh HD, and hold down Command shift.to.

View hidden files and press it again if you want to hide them. Or Also, you can find the dot node red folder inside the home directory. And there you go. You have all the files, you can secure the node red editor the same way we saw in Windows. Okay, in this video, we've learned why we should integrate All no dread on your local machine, how to install and deploy no dread on your local computers, be it a Windows or a Mac, and how to secure your node raid editor. In the next video, we'll learn how to deploy node red in a single board computer.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.