- Before making an installation of Mongodb on ubuntu we need to add sources list to local repository.
- First of all, we need to add MongoDB Public GPG Key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
- Next, we need to update source list /etc/apt/source.list.d/mongodb.list file using following command
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
- Now, we need to update the repository...
sudo apt-get update
- Now , we are ready to install our MongoDB installation
apt-get install mongodb-10gen=2.2.3
- Now we had installed MongoDB , we need to start the service
service mongodb start
- To login into mongodb prompt, we give command
mongo
- If you need mongodb help, use command
db.help()