From charlesreid1

Starting

MongoDB can be started with systemd, or using the init.d startup scripts. I hate systemd so I went with the latter.

Start by creating the directory where MongoDB will keep all of its data. For example, I used /opt/mongodb. Set the permissions so that the mongodb user/group can read/write to this directory:

sudo chown -R mongodb:mongodb mongodb/

Now start the service, which is defined in /etc/init.d/mongodb:

sudo service mongodb start

You can issue the status command in place of the start command to check if the process is running:

$ sudo service mongodb status
● mongodb.service - LSB: An object/document-oriented database
   Loaded: loaded (/etc/init.d/mongodb; bad; vendor preset: enabled)
   Active: active (running) since Tue 2018-01-30 16:59:10 PST; 1min 38s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1962 ExecStart=/etc/init.d/mongodb start (code=exited, status=0/SUCCESS)
 Main PID: 13596 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mongodb.service
           └─1973 /usr/bin/mongod --config /etc/mongodb.conf

Jan 30 16:59:09 jupiter systemd[1]: Starting LSB: An object/document-oriented database...
Jan 30 16:59:09 jupiter mongodb[1962]:  * Starting database mongodb
Jan 30 16:59:10 jupiter mongodb[1962]:    ...done.
Jan 30 16:59:10 jupiter systemd[1]: Started LSB: An object/document-oriented database.

You can also turn on logging, and look at the log files in /var/log/mongodb/mongodb.log [[Category:2018