Install MongoDB on Ubuntu

MongoDB is an open-source document database, and the leading NoSQL database. Written in C++.

This example is using MongoDB 2.4.6, running on Ubuntu13.4, both MongoDB client and server console are run on localhost, same machine.

  • Download MongoDB from here.
  • Enter into the directory where the MongoDB is downloaded. By default it downloads in “Downloads” directory
$ cd Downloads/
  • Unzip the tar file.
$ tar xzf mongodb-linux-i686-2.4.6.tgz
  • Move mongodb-linux-i686-2.4.6 to mongodb
$ sudo mkdir /usr/lib/mongodb

$ sudo mv mongodb-linux-i686-2.4.6 /usr/lib/mongodb/

  • Before you start mongod for the first time, you will need to create the data directory. By default, mongod writes data to the /data/db/ directory. To create this directory, and set the appropriate permissions use the following commands:
# mkdir -p /data/db

# chmod 777 /data/*
 

1st command prompt: Start mongodb server

$ cd /usr/lib/mongodb/mongodb-linux-i686-2.4.6/bin/

$ ./mongod

mongo

2nd command prompt: Start the client

$ cd /usr/lib/mongodb/mongodb-linux-i686-2.4.6/bin/

$ ./mongo

mongo1

mongo2

Reference:

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

Note: The information provided here is best of my knowledge and experiences if at all any modifications are to be made please help me with your valuable suggestions which are always welcome…. :)

Advertisements

2 Responses to Install MongoDB on Ubuntu

  1. Thanks for useful post on MongoDB!!

    Like

  2. Hi Vignesh, thanks for visiting, I hope you enjoy the article 🙂

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: