How to Install MongoDB on Ubuntu 14.04
In this post we will learn to install MOngoDB on ubantu 14.04.
In modern web applications, the major issue arises with managing data, since its growth rate is almost exponential. To handle this situation you need a scalable database. MongoDB is a scalable, open source, high performance, document oriented database.MongoDB is a free and open-source NoSQL document database used commonly in modern web applications. MongoDB falls under the broader category called NoSQLb databases. This post focuses on how to install MongoDB and the Next post is about How to take backup of MongoDB database and store it to S3.
We will start with the Installation process. First you are required to have machine with Ubuntu 14.04 LTS (Long Term Services) installed. Now follow the steps given below :
-
Import Public KeyThese steps will import the MongoDB GPG public key. It is required for authenticity of software packages by verifying that they are signed with GPG keys.So run:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
-
Create a List FileTo inform APT, from where to download the packages, you will need to add MongoDB repository details. Below command will create a list for MongoDB.Run:
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
-
Update Package listAfter adding the repository details, you are required to update the packages list.To update package list use the following commands.
So run:sudo apt-get update
-
Install MongoDBNow, you are ready to install MongoDB. Following command will install latest stable version of MongoDB and other helpful management tools required for MongoDB server.Run:
sudo apt-get install -y mongodb-org
-
VerifyAbove command will start MongoDB automatically. To check run the following command:
service mongod status
You will get mongod running status with process ID.verification Sucessfull !
Some useful command for MongoDB:
-
To start MongoDB:
service mongod start
-
To stop MongoDB:
service mongod stop
-
To restart MongoDB:
service mongod restart
Congratulations! You have installed MongoDB.
BackupsIf you are worried about backups than mongodump is the solution. Here is the complete way to take backup of mongodb and store it to S3 with a cron.
References:
-
http://irohinichoudhary.blogspot.in/2015/01/mongodb.html