This video is a tutorial on how to install Node RED on Ubuntu 16.04
Here is a link to get you started...
https://diyprojects.io/node-red-installation-configuration-ubuntu-16-04-lts/#.Ws4ZwNPwYad
Start by making sure your system is up to date....
sudo apt-get update
sudo apt-get upgrade
Once you are up to date, then install the prerequisites....
sudo apt-get install nodejs-legacy
Check to make sure it installed properly by checking the version...
node -v
Then install npm....
sudo apt-get install npm
and check version on it as well...
npm -v
Once all that is done, we are ready to install node-red....
sudo npm install -g --unsafe-perm node-red node-red-admin
After it is finished we need to allow the port that it uses....
sudo ufw allow 1880
Then you can kick off node-red just to see if it works
node-red
If all goes well, it should start spitting stuff out at the command prompt showing you that its running and you can access it via the web browser
http://IP.ADDRESS:1880
Now lets set it up as a service so that it will automatically start...
sudo vi /etc/systemd/system/node-red.service
[Unit]
Description=Node-RED
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/node-red-pi --max-old-space-size=128 -v
Restart=on-failure
KillSignal=SIGINT
WorkingDirectory=/home/adrian
User=adrian
[Install]
WantedBy=multi-user.target
Save that and enable it....
sudo systemctl daemon-reload
sudo systemctl enable node-red.service
sudo systemctl start node-red.service
sudo systemctl status node-red.service
If all went well, it show active in the status.....
Lastly, lets setup a username and password for a little added security
....
node-red-admin hash-pw
this will prompt you for a password and then create a hash for it, copy and save that hash
Now you want to edit config....
sudo vi ~/.node-red/settings.js
Search for adminAuth and uncomment it
change username to whatever you want to use and then delete existing password hash and paste in the one you created.
Once you have that section uncommented out, save it and restart node-red
sudo systemctl restart node-red.service
You should now be able to hit it in the web browser and it prompt you for a password.
If you like the video, please subscribe to my channel. If you have any questions or comments ,hit me up in the comments below. As always, if there are any videos out there you would like to see that I don't already have out there, let me know and Ill see what i can do!
Тэги:
#node-red #smart_home #home_automation