Trying to install the community version of mongo on ubuntu 18.04.

Below are my unsuccessful attempts , if you don't have time - just go directly to the result in attempt #3.

Attempt #1

Using offical docs: https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-ubuntu/

Result: "Failed to start mongod.service: Unit mongod.service not found".

Reference to similar thread: https://stackoverflow.com/questions/48092353/failed-to-start-mongod-service-unit-mongod-service-not-found).

Attempt #2

Tried a simplify my steps and tried this: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04

Result: Mongo status is Active: failed (Result: exit-code)

Reference to similar thread: Mongodb don't start on Ubuntu 18.04

Attempt #3

Uninstalling and trying this: Apt-get fails on 16.04 or 18.04 installing mongodb


enter image description here

Any ideas?


I did almost the exact same thing (mongodb on Ubuntu 18.04, following the Digital Ocean instructions), and it worked fine for me. Try using apt instead of apt-get, and try installing mongodb and not mongodb-org:

apt update ; apt install mongodb

Which for me created the mongodb.service and NOT mongod.service (note the lack of "b" in the second).

techops$ systemctl status mongodb.service
* mongodb.service - An object/document-oriented database
   Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-02-15 11:48:32 EST; 5h 9min ago
     Docs: man:mongod(1)
 Main PID: 4136 (mongod)
    Tasks: 23 (limit: 4665)
   CGroup: /system.slice/mongodb.service
           `-4136 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf

Feb 15 11:48:32 techops systemd[1]: Started An object/document-oriented database.

Note that the service is called mongodb even though the executable is mongod.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.