How to Install MongoDB on Ubuntu 14.04

This article demonstrates the easiest way to install MongoDB on Ubuntu. It’ll give out the entire procedure in utterly simple steps. MongoDB is assumed to be the replacement of traditional relational databases. It’s one of the leading Open Source NoSQL document-oriented database. However, if you are working in the field of IoT, you might want to read our post on setting up the Node-RED tool.

How to Install MongoDB on Ubuntu 14.04.

MongoDB is developed in C++ language and is designed to work with large web applications. It is unlike other databases and introduces Collections as alternate to tables and Document as a set of key-value pairs which is equivalent to tuples in standard databases.

1- Pre-requisites.

1.1- You must have a Ubuntu 14.04 LTS server installation.

1.2- You should either be a root user or can be a non-root user but with <sudo> access privileges.


2- Step by step process to install MongoDB.

Coming back to the objective of this article is to assist you in setting up MongoDB on your Ubuntu 14.04 server hosted in a production application environment. Let’s now look into the step-by-step instructions.

2.1- First import the MongoDB public key used by the package management system.

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10

2.2- Then create a list file for MongoDB.

echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

2.3- Now reload the package database.

sudo apt-get update

2.4- At this point, installing MongoDB is as simple as running just one command.

sudo apt-get install -y mongodb-org


3- Setup MongoDB as a System Service.

It’s easy to setup MongoDB as a system service. Follow the below steps.
3.1- Start-Up MongoDB.

sudo service mongod start

3.2- Check MongoDB Service Status.

sudo service mongod status

3.3- Shutdown MongoDB.

sudo service mongod stop

3.4- Restart MongoDB.

sudo service mongod restart

3.5- Confirm the MongoDB version.

mongo db

# It should print like this.
# MongoDB shell version: 2.6.10


Final word.

So this was all about the MongoDB installation process on Ubuntu 14.04 server. In my next article, I’ll be talking about “How to setup MongoDB for use and will cover the creation of Collections and Documents“.

See you till then, Enjoy reading!!!





  1. MongoDB expert Reply
    • Harsh S. Reply