How to Install MongoDB on Ubuntu
By Anuket Jain On 5 November 2015 In Linux
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.
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
just don’t work
Let me know what issue are you facing?
Not working in my Ubuntu 15.10
Failed to start mongod.service: Unit mongod.service failed to load: No such file or directory.
Again follow below steps:
# sudo apt-get purge mongodb-org
# sudo apt-get autoremove
# sudo rm /etc/apt/sources.list.d/mongodb.list
# echo “deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main” | # sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# sudo apt-get update
# sudo apt-get install -y mongodb-org
# sudo service mongod start
Let me know If still you face an issue.