1. Download mongoDB:
You should place the mongoDB binaries in a central location on the file system that is easy to access and control. Consider /opt.
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.1.tgz
Note: This is Linux 32-bit release. 32-bit builds have certain limitations.
2. Once you've downloaded the release, issue the following command to extract the files from the archive:
tar -zxvf mongodb-linux-i686-2.4.1.tgz
Optional: You may use the following command to copy the extracted folder into a more generic location.
[root@Master opt]# cp -R mongodb-linux-i686-2.4.1/ mongodb
3. 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, use the following command:
mkdir -p /data/db
4. Launch mongoDB instance:
./mongod
5. You can use the mongo shell to connect to your mongoDB instance by issuing the following command at the system prompt:
./mongo
6. This will connect to the database running on the localhost interface by default. At the mongo prompt, issue the following two commands to insert a record in the "test" collection of the (default) "test" database and then retrieve that record:
> db.test.save( { a: 1 } )
> db.test.find()