Skip to content

Instantly share code, notes, and snippets.

@nonkronk
Last active March 31, 2023 23:46
Show Gist options
  • Save nonkronk/0dc338df7bd1909dd7ffcc8750b88ee9 to your computer and use it in GitHub Desktop.
Save nonkronk/0dc338df7bd1909dd7ffcc8750b88ee9 to your computer and use it in GitHub Desktop.
Install & autostart Node-RED on OpenWRT

Install & Auto-start Node-RED on OpenWrt

Install Node

opkg update
opkg install node-npm

Install Node-RED & pm2

npm install -g --unsafe-perm node-red; npm install -g pm2

Create a Node-RED service

# Start Node-RED
pm2 start `which node-red` -- -v
# Save the service
pm2 save
# Create a service file
cat << EOF > /etc/init.d/pm2-root
#!/bin/sh /etc/rc.common
/usr/bin/pm2 start `which node-red` -- -v
EOF
# Make it executable
chmod +x /etc/init.d/pm2-root
# Enable the service
/etc/init.d/pm2-root enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment