# Auto start node-red in ubuntu

**URL:** <https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627>\
**Category:** General\
**Created:** [7 November 2019 09:59 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627 "2019-11-07T09:59:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [7 November 2019 09:59 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/1 "2019-11-07T09:59:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 November 2019 10:06 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/2 "2019-11-07T10:06:12Z")

</div>

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](https://nodered.org/docs/getting-started/raspberrypi)

---

<div class="post-metadata">

**Author:** ![Iliyas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iliyas/32/19045_2.png) [@Iliyas](https://discourse.nodered.org/u/Iliyas)\
**Post date:** [28 November 2019 05:44 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/3 "2019-11-28T05:44:36Z")

</div>

okay thank you sir

---

<div class="post-metadata">

**Author:** ![khoat0](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khoat0/32/46207_2.png) [@khoat0](https://discourse.nodered.org/u/khoat0)\
**Post date:** [9 August 2021 11:46 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/4 "2021-08-09T11:46:59Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [9 August 2021 11:48 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/5 "2021-08-09T11:48:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![khoat0](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khoat0/32/46207_2.png) [@khoat0](https://discourse.nodered.org/u/khoat0)\
**Post date:** [9 August 2021 12:14 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/6 "2021-08-09T12:14:54Z")

</div>

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:

```auto
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):

```auto
[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).

 ![Digital Ocean Installing Node-RED autostart on boot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e76a247c66e89e5f328b5f02d3511fa2cf5fcb4f.png)

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

```auto
sudo systemctl enable nodered.service

```

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

```auto
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:

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

```

 ![Digital Ocean Node-RED Installed testing](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/c/6ca94b3c0ff2aa9350d85fd11b04d6773ed1c130.png)

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

I succeeded, your instructions are sketchy ( [Running on Raspberry Pi : Node-RED (nodered.org)](https://nodered.org/docs/getting-started/raspberrypi)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [9 August 2021 12:17 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/7 "2021-08-09T12:17:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![khoat0](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khoat0/32/46207_2.png) [@khoat0](https://discourse.nodered.org/u/khoat0)\
**Post date:** [9 August 2021 15:39 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/8 "2021-08-09T15:39:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![khoat0](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khoat0/32/46207_2.png) [@khoat0](https://discourse.nodered.org/u/khoat0)\
**Post date:** [9 August 2021 15:40 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/9 "2021-08-09T15:40:42Z")

</div>

As your suggestion, here's a link to the tutorial:  
[Access Node-RED Dashboard from Anywhere using Digital Ocean | Random Nerd Tutorials](https://randomnerdtutorials.com/access-node-red-dashboard-anywhere-digital-ocean/)

---

<div class="post-metadata">

**Author:** ![khoat0](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khoat0/32/46207_2.png) [@khoat0](https://discourse.nodered.org/u/khoat0)\
**Post date:** [9 August 2021 15:50 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/10 "2021-08-09T15:50:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [9 August 2021 16:43 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/11 "2021-08-09T16:43:39Z")

</div>

> [@khoat0](#):
>
> 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?

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.

> [@khoat0](#):
>
> Hi @knolleary. Can you please tell me, the founder and main code that creates node-red is you?

Yes.

---

<div class="post-metadata">

**Author:** ![khoat0](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/khoat0/32/46207_2.png) [@khoat0](https://discourse.nodered.org/u/khoat0)\
**Post date:** [9 August 2021 17:14 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/12 "2021-08-09T17:14:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![1onkar](https://avatars.discourse-cdn.com/v4/letter/1/ba9def/32.png) [@1onkar](https://discourse.nodered.org/u/1onkar)\
**Post date:** [17 December 2021 15:49 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/13 "2021-12-17T15:49:33Z")

</div>

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](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04) , installed node-red following [How to install and configure Node-RED on Ubuntu 16.04 | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-connect-your-internet-of-things-with-node-red-on-ubuntu-16-04).  
If I start manual , it works but not start auto on reboot.  
Please advise. Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 December 2021 16:20 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/14 "2021-12-17T16:20:43Z")

</div>

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](https://nodered.org/docs/getting-started/raspberrypi)

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`

---

<div class="post-metadata">

**Author:** ![1onkar](https://avatars.discourse-cdn.com/v4/letter/1/ba9def/32.png) [@1onkar](https://discourse.nodered.org/u/1onkar)\
**Post date:** [17 December 2021 23:57 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/15 "2021-12-17T23:57:31Z")

</div>

Thank you very much @Colin  
It works !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 December 2021 23:57 UTC](https://discourse.nodered.org/t/auto-start-node-red-in-ubuntu/17627/16 "2021-12-31T23:57:46Z")

</div>

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