Skip to content

Instantly share code, notes, and snippets.

@m-antoni
Created November 22, 2019 16:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-antoni/4f394a51015f6cfe514eadd98cee73e1 to your computer and use it in GitHub Desktop.
Save m-antoni/4f394a51015f6cfe514eadd98cee73e1 to your computer and use it in GitHub Desktop.
MongoDB doesn't start in Ubuntu 18.04

MongoDB doesn't start in Ubuntu

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

Solution

$ sudo nano /etc/systemd/system/mongodb.service

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target
  • Now you can start the service and check its state by

      $ sudo systemctl start mongodb
    
      $ sudo systemctl status mongodb
    
  • and finally enable it permanently by

      $ sudo systemctl enable mongodb
    
  • to start the daemon

     $ sudo mongod
    
  • to access the shell

      $ sudo mongo
    
@tonieuy
Copy link

tonieuy commented Jul 22, 2023

mantap cuyyy, your tutorial can solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment