Thursday, February 19, 2015

Install MongoDB on Ubuntu

             MongoDB is a cross-platform, document oriented database that provides,high performance, high availability, and easy scalability.This guide helps to install the mongodb on ubuntu.

Step 1: Search for the mongodb package avaliable but initially it may not be present
sudo apt-cache search mongodb
Step 2: Add the package to /etc/apt/sources.list.d because its the the latest stable MongoDB version
vim /etc/apt/sources.list.d/mongodb.list
Add the following link into the mongodb.list file
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Step 3: Import the GPG key
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
Step 4 : Update the debian package using the command:
apt-get update
Step 5: Now perform search to view the package
apt-cache search mongodb
Step 6: Now the package will be present so install it using the below command:
apt-get install mongodb-10gen
Step 7: Check mongodb has started using
ps -ef | grep mongo
ls -ls /usr/bin | grep mongo
Step 8: The mongodb control script is generated at /etc/init.d/mongodb,the MongoDB config file is at /etc/mongodb.conf add the below details:
 verbose = true
dbpath = /data/db
logpath = /var/log/mongodb.log
logappend = true
port = 27017

Step 9: Start the mongodb as a service
service mongodb start
Step 10 :Check mongodb service has started using
ps -ef | grep mongodb
Step 11 : To stop/restart perform the below commands:
service mongodb stop
service mongodb restart
Thus the installation has been very simple in ubuntu.


0 comments:

Post a Comment