How to install mongodb in ubuntu 16.04/14.04

Hi Techrunnr Readers, This document deals with how to install mongodb in ubuntu 16.04
MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemata.

Step 1 – Setup Apt Repository
First, we will add the PGP key and repository,

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

2. Do system update and Install mongodb

sudo apt-get update
sudo apt-get install mongodb-org

If you want to install any specific version then follow this

sudo apt-get install mongodb-org=3.6.3 mongodb-org-server=3.6.3 mongodb-org-mongos=3.6.3 mongodb-org-tools=3.6.3

3. Enable the Service

sudo systemctl enable mongod


sudo systemctl start mongod

4. Start/Stop the service

sudo systemctl stop mongod


sudo systemctl restart mongod

5. Check Installed mongodb Version

mongod --version

db version v3.6.3
git version: sdsadasdfff70f9ca4b43c26892cd55257e1a5

© 2018, Techrunnr. All rights reserved.

#1
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.