This article demonstrates the easiest way to install MongoDB on Ubuntu. It’ll give out the entire procedure in utterly simple steps. MongoDB is assumed to be the replacement for traditional relational databases. It’s one of the leading Open Source NoSQL document-oriented databases. However, if you are working in the field of IoT, you might want to read our post on setting up the Node-RED tool.
Install MongoDB on Ubuntu
MongoDB is developed in C++ language and is designed to work with large web applications. It is unlike other databases and introduces Collections as an alternative to tables and Document as a set of key-value pairs which is equivalent to tuples in standard databases.
1.1- You must have a Ubuntu 14.04 LTS server installation.
1.2- You should either be a root user or can be a non-root user but with <sudo> access privileges.
Step-by-Step Process to Install MongoDB.
Coming back to the objective of this article is to assist you in setting up MongoDB on your Ubuntu 14.04 server hosted in a production application environment. Let’s now look into the step-by-step instructions.
2.1- First import the MongoDB public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
2.2- Then create a list file for MongoDB.
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
2.3- Now reload the package database.
sudo apt-get update
2.4- At this point, installing MongoDB is as simple as running just one command.
sudo apt-get install -y mongodb-org
Set up MongoDB as a System Service.
It’s easy to set up MongoDB as a system service. Follow the below steps.
3.1- Start-Up MongoDB.
sudo service mongod start
3.2- Check MongoDB Service Status.
sudo service mongod status
3.3- Shutdown MongoDB.
sudo service mongod stop
3.4- Restart MongoDB.
sudo service mongod restart
3.5- Confirm the MongoDB version.
mongo db # It should print like this. # MongoDB shell version: 2.6.10
Final Word – Install MongoDB on Ubuntu
So this was all about the MongoDB installation process on Ubuntu 14.04 server. In my next article, I’ll be talking about “How to set up MongoDB for use and will cover the creation of Collections and Documents“.
See you till then, Enjoy reading!!!