For whatever reason, whenever i try to start mongodb as a service (sudo service mongod start) i get the following error.

Failed to start mongod.service: Unit mongod.service not found. I followed Installation Steps mention following link mongo db installation failed

system> sudo systemctl start mongodb
Failed to start mongodb.service: Unknown unit: mongodb.service

And when I try sudo mongod .

MongoDB shell version: 3.2.13 connecting to: -
2017-06-03T16:19:28.513+0530 W NETWORK [thread1]
Failed to connect to, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-03T16:19:28.514+0530 E QUERY [thread1]
Error: couldn't connect to server, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

And when I try mongod --repair .

2017-06-03T16:32:35.514+0530 I CONTROL [initandlisten]
MongoDB starting : pid=17423 port=27017 dbpath=/data/db 64-bit host=sid-Ideapad-Z570 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] db version v3.2.13 [listen] target_arch: x86_64 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] options: {} 2017-06-03T16:32:35.540+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
Best Answer

I reinstalled mongod-org, since my data will still stay safe.

The problem was that my system couldn't find mongod.service when I ran sudo service mongod status .

Running this fixed it and restored the service.

sudo systemctl enable mongod

Then all I had to do was copy my correct config to /etc/mongod.conf and run

sudo service mongod restart