Pls help NodeJs Installation
by habbey2080 from LinuxQuestions.org on (#51HS5)
Hello Everyone,
Please I am attempting to install an application server using vagrant and linux built on centos. The installation was successful but the application server is not running. I have attempted to trouble-shoot it but no head way yet. Your help will be appreciated.
[vagrant@nodejs ~]$ systemctl status node
a- node.service - NodeJS application server
Loaded: loaded (/etc/systemd/system/node.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2020-04-01 02:53:36 EDT; 56s ago
Main PID: 4631 (code=exited, status=1/FAILURE)
[vagrant@nodejs ~]$ ls -Al /etc/modules-load.d/
total 0
[vagrant@nodejs ~]$ systemctl status node
a- node.service - NodeJS application server
Loaded: loaded (/etc/systemd/system/node.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2020-04-01 02:53:36 EDT; 21min ago
Main PID: 4631 (code=exited, status=1/FAILURE)
[vagrant@nodejs ~]$
---------------------
NodeJs file
----
mv /tmp/node.service /etc/systemd/system/
appdir="/opt/app"
echo "Creating the application directory"
if ! [ -d $appdir ]; then
mkdir $appdir
fi
echo "Installing the EPEL repository"
yum -y install epel-release
echo "Install Node.js"
yum -y install nodejs
echo "Deploying the application files"
#cp -r vagrant/appfiles/* $appdir/
cp -r /vagrant/appfiles/* $appdir/
echo "Installing the dependencies of nodejs"
cd $appdir
npm Install
echo "Making the server.js file execuatble"
chmod +x server.js
echo "Starting the application"
systemctl start node
systemctl enable node
-------------------------------------------
Node Service file
[Unit]
Description=NodeJS application server
[Service]
ExecStart=/opt/app/server.js
Restart=always
User=nobody
Group=nobody
Environment=PATH=/usr/bin:/usr/local/bin
WorkingDirectory=/opt/app
[Install]
WantedBy=multi-user.target
Abi


Please I am attempting to install an application server using vagrant and linux built on centos. The installation was successful but the application server is not running. I have attempted to trouble-shoot it but no head way yet. Your help will be appreciated.
[vagrant@nodejs ~]$ systemctl status node
a- node.service - NodeJS application server
Loaded: loaded (/etc/systemd/system/node.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2020-04-01 02:53:36 EDT; 56s ago
Main PID: 4631 (code=exited, status=1/FAILURE)
[vagrant@nodejs ~]$ ls -Al /etc/modules-load.d/
total 0
[vagrant@nodejs ~]$ systemctl status node
a- node.service - NodeJS application server
Loaded: loaded (/etc/systemd/system/node.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2020-04-01 02:53:36 EDT; 21min ago
Main PID: 4631 (code=exited, status=1/FAILURE)
[vagrant@nodejs ~]$
---------------------
NodeJs file
----
mv /tmp/node.service /etc/systemd/system/
appdir="/opt/app"
echo "Creating the application directory"
if ! [ -d $appdir ]; then
mkdir $appdir
fi
echo "Installing the EPEL repository"
yum -y install epel-release
echo "Install Node.js"
yum -y install nodejs
echo "Deploying the application files"
#cp -r vagrant/appfiles/* $appdir/
cp -r /vagrant/appfiles/* $appdir/
echo "Installing the dependencies of nodejs"
cd $appdir
npm Install
echo "Making the server.js file execuatble"
chmod +x server.js
echo "Starting the application"
systemctl start node
systemctl enable node
-------------------------------------------
Node Service file
[Unit]
Description=NodeJS application server
[Service]
ExecStart=/opt/app/server.js
Restart=always
User=nobody
Group=nobody
Environment=PATH=/usr/bin:/usr/local/bin
WorkingDirectory=/opt/app
[Install]
WantedBy=multi-user.target
Abi