Skip to content

Instantly share code, notes, and snippets.

@sdntechforum
Last active June 3, 2023 02:22
Show Gist options
  • Save sdntechforum/c3c30d4a593e3d51d1494bb9bf991891 to your computer and use it in GitHub Desktop.
Save sdntechforum/c3c30d4a593e3d51d1494bb9bf991891 to your computer and use it in GitHub Desktop.
Node Red Install on Cloud VM
sudo nano /etc/systemd/system/nodered.service
#Insert the commnds below
[Unit]
Description=Node-RED
After=syslog.target network.target
[Service]
ExecStart=/usr/local/bin/node-red --max-old-space-size=128 -v
Restart=on-failure
KillSignal=SIGINT
# log output to syslog as 'node-red'
SyslogIdentifier=node-red
StandardOutput=syslog
# non-root user to run as
#WorkingDirectory=/home/rui/
#User=rui
#Group=rui
# if using a root user
WorkingDirectory=/root/
User=root
Group=root
[Install]
WantedBy=multi-user.target
# Install nodered
sudo yum update && sudo yum upgrade -y
sudo yum install npm -y
sudo npm install -g --unsafe-perm node-red
!
# Allow Node Red port on VM firewall
# On RHEL / CentOS / Oracle Linux systems execute the following commands:
sudo firewall-cmd --zone=public --add-port=1880/tcp
sudo firewall-cmd --zone=public --add-port=1880/tcp --permanent
sudo firewall-cmd --reload
# Start Node-red
sudo node-red start
!
#insall node-red-admin
sudo npm install -g node-red-admin
# Now add a username/password for NodeRed Login
# Generate a password hash
node-red-admin hash-pw
# Copy the hash output
# Open the settings.js file:
sudo nano ~/.node-red/settings.js
#uncomment the adminAuth block and Change username to whatever you like, and
#paste the previously generated hash into the password field.
!
sudo reboot
!
http://YOUR-Cloud-VM-IP-Address:1880
!
# Autostart Node-RED on Boot
# create a new systemd file for the nodered.service:
sudo nano /etc/systemd/system/nodered.service
# copy the code from gist above
sudo systemctl enable nodered.service
sudo reboot
!
# To enable the Node-RED service and run this file on boot,
Link to nodered documentation
https://nodered.org/docs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment