Start node.js application using systemd on RHEL 7

In a test or development environment we can start a node.js application with npm start . But this is not, what we want to do in production.

We need to start the application as soon as the server is up and running.

Here is a quick and easy way to achieve this goal.

Create a new file in /etc/systemd/system ( domino-db.service for example )

Description=domino-node-list sample



Modify ExecStart and WorkingDirectory to point to the correct path in your installation.

Save domino-db.service and set execution rights to 744.

Check app.js for proper execution right (744).

Edit app.js and add

#!/usr/bin/env node

as the first line in the code.

Enable the service

systemctl enable domino-db

Created symlink from /etc/systemd/system/ to /etc/systemd/system/domino-db.service.

Check with

systemctl status domino-db

● domino-db.service - domino-node-list sample
   Loaded: loaded (/etc/systemd/system/domino-db.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-12-30 10:24:04 CET; 4min 15s ago
 Main PID: 7163 (node)
    Tasks: 7
   CGroup: /system.slice/domino-db.service
           └─7163 node /git/domino-node-list/app.js

Dec 30 10:24:04 systemd[1]: Started domino-node-list sample.
Dec 30 10:24:04 systemd[1]: Starting domino-node-list sample...
Dec 30 10:24:05 app.js[7163]: Example app listening at http://:::3000

You can now start and stop the service at any time using

systemctl start domino-db
systemctl stop domino-db

Ubuntu – reset root password

I wanted to update a virtual machine from Ubunto 9.10 to 10.04 but I could not recall the root password. None of my standard passwords worked.
Google to the rescue, I found a way to reset the root password.

1) Login as non-root user
2) sudo su –
3) type in the password for the non-root user
4) passwd
5) set new root password

Now updating to Ubuntu 10.04

ESXi 3.5, SSH And FTP

VMware ESXi ships with the ability to run SSH, but the feature is disabled by default and not supported. Even FTP is disabled so you cannot upload images to the server for installation.

To enable SSH and FTP, you have to access the console. Obviously it is not intended by VMware to access the console as you would do in a regular Linux system. But, as always, there is a little magic to accomplish the aim.

At the console of the VMware ESXi host, press ALT+F1 to access the console window. Enter the word unsupported in the console and then press Enter. You will not see the text you type in.

If you typed in unsupported correctly, you can enter the password for the root login. You should then see the prompt ~ #.

To enable SSH and/or FTP, edit /etc/inetd.conf and remove the comments on #SSH and #FTP. Save the file and restart the server or inetd process.

Now you can access the host via SSH and/or FTP.