Installing MongoDB in Ubuntu is pretty easy. The following steps will guide you on how to install and run the mongodb server.
Download MongoDB to your Ubuntu box. Check the version from http://www.mongodb.org/downloads. Let download the latest 64bit production release (currently, 2.4.6).
Run the following command to extract the tgz file.
You are almost done with this tutorial. Let’s create a directory to hold all your mongodb data. You will instruct mongodb to store all your data here . We will start the mongodb server after we have created the data/db directory.
$ cd mongodb-linux-x86_64-2.4.6/bin
$ ./mongod --dbpath ~/data/db
$ Fri Sep 27 17:13:05.117 [websvr] admin web console waiting for connection on port 28017
Connect to your mongdb is easy by using of mongo shell. Make sure you are at the correct directory.
MongoDB shell version: 2.4.6
connecting to: 192.168.71.160:27017/test