sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10

Create a list file for MongoDB. Create the /etc/apt/sources.list.d/mongodb.list list file using the following command:

echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

Reload local package database.

sudo apt-get update
sudo apt-get install mongodb-org

Install a specific release of MongoDB:

Specify each component package individually and append the version number to the package name, as in the following example that installs the 2.6.1 release of MongoDB:

apt-get install mongodb-org=2.6.1 mongodb-org-server=2.6.1 mongodb-org-shell=2.6.1 mongodb-org-mongos=2.6.1 mongodb-org-tools=2.6.1

Pin a specific version of MongoDB. Although you can specify any available version of MongoDB, apt-get will upgrade the packages when a newer version becomes available. To pin the version of MongoDB at the currently installed version, issue the following command sequence:

echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections

Issue the following command to start mongod:

sudo /etc/init.d/mongod start

Verify that MongoDB has started successfully. Verify that the mongod process has started successfully by checking the contents of the log file at


Stop MongoDB. As needed, you can stop the mongod process by issuing the following command:

sudo /etc/init.d/mongod stop


sudo /etc/init.d/mongod restart

Wait it will come more!!
Mongo DB from Scratch

Leave a Reply

Your email address will not be published.