Install Node-RED On A Virtual Machine - IOTROUTER
Une fois toutes les 5 minutes

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 Embedded Linux 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

Fixer le nœud rouge

La tâche suivante consiste à se connecter à l'instance et à installer node.js et Node-RED.

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

Une fois connecté, vous devez installer node.js et 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

À ce stade, vous pouvez tester votre instance en exécutant node-red. NOTE : Il se peut que vous receviez des erreurs concernant les nœuds en série - ceci est normal et peut être ignoré.

Une fois que vous avez commencé, vous pouvez vous connecter à l'adresse suivante : http:// :1880/.

Pour que Node-RED démarre automatiquement lorsque votre instance redémarre, vous pouvez utiliser pm2 :

sudo npm install -g -unsafe-perm pm2

pm2 start `qui node-red` - -v

pm2 sauver

démarrage de pm2

NOTE : Cette dernière commande vous demandera d'exécuter une autre commande - assurez-vous de faire ce qu'elle vous dit.

Mots-clés : Passerelle LoRa