0

I'm using this official guide to install MongoDB on my Ubuntu 16.04 (Xenial Xerus). At Run MongoDB Community Edition I got

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

After typing sudo service mongod start. I just looked into /var/log/mongodb, and it's empty. I didn't have any other error before this problem. How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
rado
  • 5,720
  • 5
  • 29
  • 51

1 Answers1

19

For updates check here.

Steps to install MongoDB Community Edition on Ubuntu 16.04

Run these commands in Terminal (Ctrl + Alt + T):

To remove an already installed MongoDB

  1. sudo apt-get purge mongodb-org*

  2. sudo rm -r /var/log/mongodb sudo rm -r /var/lib/mongodb

Then start installing with the following commands:

  1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

  2. echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

  3. sudo apt-get update

  4. sudo apt-get install -y mongodb-org

To start MongoDB run:

sudo service mongod start
Jyothi Babu Araja
  • 10,076
  • 3
  • 31
  • 38
  • 1
    I don't know how since this are the exactly instructions from official guide, but this worked after I changed my server from `sudo apt-get update` and `upgrade`. I think the problem was related to this, and not mongodb actually. Thanks, anyway! – rado Dec 29 '16 at 16:44