Mongodb : Install on Ubuntu

December 12th, 2013 § 0 comments § permalink

As part of getting started to NoSQL DB’s I thought of trying out MongoDB.

Installation

Installation was quite easy. Here is how I installed mongoDB on your ubuntu.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

Thats it, installation is over.

Start mongoDB

The mongoDB is setup with upstart, so you can start the service with the following command

sudo service mongodb start

Explore CLI

You can enter into mongoDB CLI to explore more, just type mongo in your terminal

mongoDB CLI

mongoDB CLI

Everything is fine. But when I do unclean shutdown sometimes, mongoDB service won’t start automatically. So after each unclean shutdown I need to do remove the lock file and start service manually.

sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb start

Happy exploring mongoDB.