How to Install MongoDB on Ubuntu

MongoDB is a free and open-source NoSQL document database used commonly in modern web applications. MongoDB offers a high performance, high availability, and automatic scaling enterprise database. MongoDB is a NoSQL database, so you can’t use SQL (Structured Query Language) to insert and retrieve data, and it does not store data in tables like MySQL or Postgres.
MongoDB on Ubuntu

Step #1: Import the Public Key

First we’ll import the MongoDB public key using following command:

# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

Step #2: Creating a List File

Then we’ll create a list file for MongoDB.

# 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

Step #3: Update the repository

Now, update the repository using command:

# sudo apt-get update

Step #4: Install MongoDB on Ubuntu

Now, we can install MongoDB using following command:

# sudo apt-get install mongodb-org

Step #5: Start MongoDB

Start MongoDB server using following command:

For Ubuntu 12.04/14.04
# sudo /etc/init.d/mongod start
For Ubuntu 15.04/15.10
# sudo systemctl start mongod

Enjoy it!

Comments
  1. 8 years ago
    • 8 years ago
  2. 8 years ago
    • 8 years ago

Leave a Reply to alex Cancel reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.