How to Install MongoDB on Ubuntu

Share It!

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:// --recv 7F0CEB10

Step #2: Creating a List File

Then we’ll create a list file for MongoDB.

# echo "deb "$(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!

  1. 10 months ago
    • 10 months ago
  2. 8 months ago
    • 5 months ago

Leave a Reply

Your email address will not be published.