How to Install MongoDB on Ubuntu 16.04 VPS

How to Install MongoDB on Ubuntu 16.04.

MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc. and is published under a combination of the GNU Affero General Public License and the Apache License.

To install Mongo DB first import public key by package management system.
sudo apt-key adv --keyserver hkp:// --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
After create a list file for it:
echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
Use the following command to reload the local package database:
sudo apt-get update

Now install the MongoDB packages and start it by following this command
sudo apt-get install -y mongodb-org
sudo systemctl start mongod

Use this to Stop
sudo service mongod stop
And this to Restart
sudo service mongod restart

To finish enable MongoDB:
sudo systemctl enable mongodb

You have successfully installed MongoDB in Ubuntu 16.04
MongoDB in VPSie
Enjoy it.

Register for free account now.

Related Articles