In this article, I would like to guide how we install a MongoDb instance on Ubuntu virtual machine that you have installed.

Prerequisite conditions

  • You must install an Ubuntu OS virtual machine on VWareWorkstation application or any box supports you create a virtual machine.
  • Putty client that can connect to the virtual machine.
  • Ubuntu OS must be 12.04 or 14.04 LTS version

Install MongoDB

Step 1: Connect to the virtual machine through Putty

Step 2: Register the MongoDB packages with Ubuntu

sudo apt-key adv –keyserver hkp:// –recv EA312927


Step 3: Create list of folder to store mongodb such as data files and log files

echo “deb trusty/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list


Step 4: Update some packages before installing

sudo apt-get update

Step 5: Install MongoDB

sudo apt-get install -y mongodb-org


Connect to MongoDB

By default, a MongoDB instance named mongod runs on 27017 port and IP is or localhost

Step 1: Verify MongoDB instance status

sudo service mongod status

If status is stop/waiting, we need to start

Step 2: Start a MongoDB service

sudo service mongd start

Step 3: Stop a MongoDB service

sudo service mongd stop

Step 4: connect to MongoDB. By default, you will access test database.


Now, you’re ready to work on MongoDB.

Modify IP Address of MongDB instance

In case you want to connect to the MongoDB instance what you have installed from other client machines, you need to modify the IP address of the machine that is running the MongoDB instance instead of default value

Step 1: login with root user

sudo bash

Step 2: open mongod.conf file. There is the configuration file which mongod service uses it whenever it is started.

sudo /etc/mongod.conf

Step 3: go to line bind_ip and edit the value. In this case, bind_ip is changed instead of as default

Step 4: Cltr+X -> Y -> Cltr+A+M



2 thoughts on “How to install MongoDB Community edition on Ubuntu 14.04 LTS

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s