Install Node-RED on a virtual machine

This guide walks you through the steps of running Node-RED on an Azure virtual machine instance.

Create a base image

Log in to the Azure console

Click to add a new… virtual machine

In the list of virtual machines, select Ubuntu Server and click Create

Give your machine a name, the username you want to use, and the authentication details you want to use to access the instance

Choose the size of your instance. Keep in mind that node.js is single-threaded, so there is no benefit in choosing a size with multiple cores for a simple node-red instance. A1 Basic is a great starting point

In the Settings step, click on the Network Security Group option. Add a new “Inbound Rule” with options set to:

Name: node-red-editor

Priority: 1010

Protocol:TCP

Destination port range: 1880

Click OK on the settings page, review the summary, and click OK to deploy the new instance

After a few minutes, your instance will be running.In the console you can find the IP address of your instance

Set Node-RED

The next task is to log into the instance and install node.js and Node-RED.

Log in to your instance using the authentication details you specified in the previous stage.

Once logged in, you need to install node.js and Node-RED

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash –

sudo apt-get install -y nodejs build-essential

sudo npm install -g –unsafe-perm node-red

At this point, you can test your instance by running node-red. NOTE: You may receive some errors regarding serial nodes – this is expected and can be ignored.

Once started, you can log in at http:// :1880/.

To have Node-RED start automatically when your instance restarts, you can use pm2:

sudo npm install -g –unsafe-perm pm2

pm2 start `which node-red` — -v

pm2 save

pm2 startup

NOTE: This last command will prompt you to run another command – make sure you do what it says.

Keywords: LoRa gateway

X

Contact us

Contact us