I follow all the steps mention in mongodb installation documents.
for ubuntu 16.04
steps 1:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
steps 2:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
steps 3:
sudo apt-get update
steps 4:
sudo apt-get install -y mongodb-org
steps 5:
sudo service mongod start
when i started mongodb got an error as
"Failed to start mongod.service: Unit mongod.service not found." please help me to solve this.
I got the same error for a long while, tried almost all installation isntruciton on google but could not find te answer...
I followed the instructions from https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ but keep getting the error Failed to start mongod.service: Unit mongod.service not found
I firstly installed using: sudo apt-get install -y mongodb-org Then noticed that wher I run:
The db version was 2.6.12 instead of the latest one 4.0.3. So make sure you dont have mongodb-org-server already installed, if yes, then make sure you uupdate it to your target version (as indicated @https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ -> Step 4 - Install a specific release of MongoDB.)
target_version = 4.0.3
sudo apt-get install -y mongodb-org=target_version mongodb-org-server=target_version mongodb-org-shell=target_version mongodb-org-mongos=target_version mongodb-org-tools=target_version
and after doing this its all working for me :D
You are missing a 'b' I think?
should be
I think this is the case?
The following steps helped me solve the problem of not being able to start mongodb on Ubuntu Server 18.04 LTS
Step 1: First, remove MongoDB from previous if installed:
sudo apt remove --autoremove mongodb-org
Step 2: Remove any mongodb repo list files:
Step 3: Import the public key used by the package management system:
Step 4: Create a list file for MongoDB:
Step 5: Reload local package database:
Step 6: Install the MongoDB packages:
Step 7: Start MongoDB:
Step 8: Begin using MongoDB:
Hope it helps you.
Just follow the below commands. This has worked for me.
Uninstall your mongo completely from your system:
Now reinstall mongodb using following commands:
Note: The database server is automatically started after installation.
Next, let's verify that the server is running and works correctly.
You'll see this output:
Most probably unit mongodb.service is masked. Use following command to unmask it.
sudo systemctl unmask mongodb
and re-run
sudo service mongod start
Failed to start mongod.service: Unit mongod.service not found
If you are following the official doc and are coming across with the error above that means mongod.service is not enabled yet on you machine (I am talking about Ubuntu 16.04). You need to do that using following command
Now you can start mongodb using the following command