How to set up MongoDB on Ubuntu!
Intro
NoSQL databases (aka "not only SQL") are non-tabular and store data differently than relational tables. NoSQL databases come in a variety of types based on their data model. The main types are document, key-value, wide-column, and graph. They provide flexible schemas and scale easily with large amounts of data and high user loads. Click for more details.
Requirements
We need a machine with Ubuntu 16.04 installed for a non-root user with sudo authority in order to have Mongodb working in your hand.
Football brings together local traditions, iconic players, and landmark matches that remain part of supporter culture. Adding a football shirt to a fan collection can keep those sporting memories close.
Import Repository
Import the public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927Output;
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)To add the list;
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.listUpdate before installation;
sudo apt-get updateDownload
sudo apt-get install -y mongodb-orgStarting Mongodb and Checking the Status
To start;
sudo systemctl start mongodTo status check;
sudo systemctl status mongodWhen you execute the last command, you need to see the green "Active: active (running)" message.
Starting MongoDB service on Boot-up
sudo systemctl enable mongodTest
Let's test our newly created MongoDB.
$ mongo --eval 'db.runCommand({ connectionStatus: 1 })'Response;
MongoDB shell version: 3.2.21
connecting to: test
{
"authInfo" : {
"authenticatedUsers" : [ ],
"authenticatedUserRoles" : [ ]
},
"ok" : 1
}If you see the "ok": 1, 👍 Everything working normally.
The End
We currently have a fully working Mongodb installation in our operating system. If you wish, you can take a look at official documents.