Auto start node-red in ubuntu

Hello,
I have installed node-red and even installed pm2, how can we setup node-red to start automatically when the system gets rebooted?

Hi @Iliyas

if you use the install script we provide, it will install node-red as a systemd service that can be started on boot - rather then use pm2 which isn't recommend for running as a service.

https://nodered.org/docs/getting-started/raspberrypi

okay thank you sir

i tried your way.

     sudo systemctl enable nodered.service

However, an error occurred.

     Failed to enable unit: Unit file nodered.service does not exist.

Please help me see this error and how to fix it.
Thank you !

Hi @khoat0 - did you use the install script we provide?

I found another support :

Autostart Node-RED on Boot

To make Node-RED autostart when you boot or restart your Virtual Machine, you need to create a new systemd file for the nodered.service:

sudo nano /etc/systemd/system/nodered.service

Then, add the following (if you’re using root, you can leave the file as it is – otherwise comment the root and configure the non-root user option):

[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

Your file should look like this, save it and exit (Ctrl+X, Y, Enter key).

To enable the Node-RED service and run this file on boot, enter the command:

sudo systemctl enable nodered.service

Restart your Virtual Machine to test if Node-RED is automatically starting on boot:

sudo reboot

Wait approximately 2 to 3 minutes for your server to fully restart, when you open your server IP address Node-RED software should load automatically:

http://YOUR-Digital-Ocean-IP-Address:1880

Digital Ocean Node-RED Installed testing

That’s it! Your Node-RED software is prepared.

I succeeded, your instructions are sketchy ( Running on Raspberry Pi : Node-RED (nodered.org)

1 Like

Rather than copy and paste, please provide a link to where you found those instructions.

Their instructions are in a very long post, I just want to focus on what to do specifically. Forum rules are not to copy and paste?

As your suggestion, here's a link to the tutorial:
Access Node-RED Dashboard from Anywhere using Digital Ocean | Random Nerd Tutorials

Hi @knolleary. Can you please tell me, the founder and main code that creates node-red is you?

It isn't clear from your post what you intended by pasting in all of those instructions. Are you asking a question about them?

It is better to post a link so then readers have the context to understand what the text is. It also makes it easier to see what you have written around it.

Yes.

Hi @knolleary,
I use basic node red. I feel great with this tool for programming a simple website.
I thank you and Mr. Dave Conway-Jones does open source node red and has great community support.

However, for me about the manual part. I find it difficult to understand because it is very generic and not fully updated according to new versions.

This caused me to mess around with node red more. I know I need to read more, learn more to understand what's inside node red, however, I had very easy access to the dashboard, the ui configuration arrangement. However, such an easy thing does not happen when writing code.

This is my own feeling. Hope you and your team make node red even more accessible to the community.

Once again, I have a lot of respect for node red, the team that invented node red.

Thank you!

1 Like

Hi.. I need help to auto-start node-red on reboot.
I followed as advised but does not work. I am using Ubuntu 20.04 server. Installed nodejs using option 2 follwoing How To Install Node.js on Ubuntu 20.04 | DigitalOcean , installed node-red following How to install and configure Node-RED on Ubuntu 16.04 | DigitalOcean.
If I start manual , it works but not start auto on reboot.
Please advise. Thanks

welcome to the forum @1onkar

I suggest using the install method recommended in the node-red docs, for Debian/Ubuntu/Raspbian systems, and already suggested earlier in this thread - Running on Raspberry Pi : Node-RED

Then all you have to do to autostart on boot is to run
sudo systemctl enable nodered

You should just be able to run the script in that link and it should sort everything out. Provided you have not install n or nvm

1 Like

Thank you very much @Colin
It works !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.