# Amazon Linux 2 LTS and systemd

**URL:** <https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355>\
**Category:** Community Support\
**Created:** [March 17, 2018, 1:24am UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355 "2018-03-17T01:24:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![intelesync](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/intelesync/32/148_2.png) [@intelesync](https://forums.rocket.chat/u/intelesync)\
**Post date:** [March 17, 2018, 1:24am UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355/1 "2018-03-17T01:24:15Z")

</div>

Have successfully installed Rocket.Chat on an Amazon Linux 2 LTS instance, and can run the app directly via:  
export PORT=3000  
export ROOT\_URL=http://my-public-ip:3000/  
export MONGO\_URL=mongodb://localhost:27017/rocketchat  
node /opt/Rocket.Chat/main.js

However, getting Rocket.Chat to run via systemd is not working. My /lib/systemd/system/rocketchat.service file looks like:

[Unit]  
Description=The Rocket.Chat server  
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target  
[Service]  
StandardOutput=syslog  
StandardError=syslog  
SyslogIdentifier=rocketchat  
User=root  
Environment=MONGO\_URL=mongodb://localhost:27017/rocketchat  
Environment=ROOT\_URL=http://my-public-ip:3000/  
Environment=PORT=3000  
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js  
[Install]  
WantedBy=multi-user.target

What I get with systemctl start rocketchat.service:

[root@ip-172-30-4-231 system]# systemctl status rocketchat.service -l  
● rocketchat.service - The Rocket.Chat server  
Loaded: loaded (/usr/lib/systemd/system/rocketchat.service; enabled; vendor preset: disabled)  
Active: failed (Result: exit-code) since Sat 2018-03-17 01:07:09 UTC; 13min ago  
Process: 4148 ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js (code=exited, status=8)  
Main PID: 4148 (code=exited, status=8)

Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at Function.Module.\_load (module.js:312:12)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at Module.require (module.js:364:17)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at require (module.js:380:17)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at Object. (/opt/Rocket.Chat/main.js:4:1)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at Module.\_compile (module.js:456:26)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at Object.Module.\_extensions…js (module.js:474:10)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal rocketchat[4148]: at Module.load (module.js:356:32)  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal systemd[1]: rocketchat.service: main process exited, code=exited, status=8/n/a  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal systemd[1]: Unit rocketchat.service entered failed state.  
Mar 17 01:07:09 ip-172-30-4-231.ec2.internal systemd[1]: rocketchat.service failed.

What am I missing?

---

<div class="post-metadata">

**Author:** ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)\
**Post date:** [March 26, 2018, 6:49pm UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355/2 "2018-03-26T18:49:05Z")

</div>

What is Amazon Linux 2 LTS based on? This is a new one to me…

---

<div class="post-metadata">

**Author:** ![intelesync](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/intelesync/32/148_2.png) [@intelesync](https://forums.rocket.chat/u/intelesync)\
**Post date:** [March 27, 2018, 1:33pm UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355/3 "2018-03-27T13:33:38Z")

</div>

“Amazon Linux 2 is the next generation of Amazon Linux. It includes the latest LTS kernel (4.9) tuned for enhanced performance on Amazon EC2, systemd support, newer versions of glibc, gcc and binutils, and an additional set of core packages for performance and security improvements.”

It’s the systemd part and getting Rocket.Chat to start on system boot that kicking my butt. All else appears to work well.

---

<div class="post-metadata">

**Author:** ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)\
**Post date:** [March 27, 2018, 3:03pm UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355/4 "2018-03-27T15:03:37Z")

</div>

Not really very telling of what linux distro they based on. But based on the error looks like node\_module wasn’t found. Make sure `npm install` finishes without error.

Also make sure you are on Node.js 8.x

---

<div class="post-metadata">

**Author:** ![intelesync](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/intelesync/32/148_2.png) [@intelesync](https://forums.rocket.chat/u/intelesync)\
**Post date:** [March 28, 2018, 2:41am UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355/5 "2018-03-28T02:41:27Z")

</div>

Its the world’s largest cloud. I’m sure you can find out particulars of the OS. Yes Node runs fine. Rocket.Chat works great. Only need to get it start on system boot.

Am I the only one out there running Rocket.Chat on Amazon???

---

<div class="post-metadata">

**Author:** ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)\
**Post date:** [March 28, 2018, 4:17am UTC](https://forums.rocket.chat/t/amazon-linux-2-lts-and-systemd/355/6 "2018-03-28T04:17:02Z")

</div>

> [@intelesync](#):
>
> Am I the only one out there running Rocket.Chat on Amazon???

On Amazon no of course not. On Amazon using Amazon Linux yes… First I’ve encountered. It’s definitely not one of our officially supported distros. Ubuntu 16.04 on Amazon is and should work fine.

> [@intelesync](#):
>
> Yes Node runs fine. Rocket.Chat works great. Only need to get it start on system boot.

Try looking at: `journalctl -u rocketchat` and see what you see. Makes no sense why it would run different…

Only difference is maybe do: `sudo su` before you run manually and see what happens. That should make the runs nearly identical. But the logs should tell us something
