How to install MongoDB in Ubuntu
How to install MongoDB in Ubuntu
---------------------------------------------
This post will describe how to install and configure MongoDB. MongoDB is an open source document database and of type no sql. It stores data in the form of JSON(JavaScript Object Notation)
as a combination of documents and collection. It is highly scable and performance
Software Version used in this post were as follows:
MongoDB v3.6 and Ubuntu 18.04
Step 1 Creating Source list file
Step 2 Installing MongoDB
Step 3 Start the Mongo Deamon
Step 4 Configure User for MongoDB
--------------------------------------------------------------
STEP 1 : CREATING SOURCE LIST FILE
Importing the public key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
Creating Souce list File
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
STEP 2 : INSTALLING MONGODB
Update the Repository
sudo apt-get update
Install MongoDB
sudo apt-get install -y mongodb-org
STEP 3 : START THE MONGOd
Start the mongo deamon using the following command
systemctl start mongod
To start mongoDB during Startup
systemctl enable mongod
To Use MongoDB use,
mongo
STEP 4 : CONFIGURE USER FOR MONGODB
In the MongoDB use the following command,
use admin
To create User
db.createUser({user:"username", pwd:"password", roles:[{role:"root", db:"admin"}]})
nano /lib/systemd/system/mongod.service
Add --auth in ExecStart
ExecStart=/usr/bin/mongod --auth --config /etc/mongod.conf
Reload the deamon for updating the user credentials
sudo systemctl daemon-reload
sudo service mongod restart
mongo -u username -p password
---------------------------------------------
This post will describe how to install and configure MongoDB. MongoDB is an open source document database and of type no sql. It stores data in the form of JSON(JavaScript Object Notation)
as a combination of documents and collection. It is highly scable and performance
Software Version used in this post were as follows:
MongoDB v3.6 and Ubuntu 18.04
Step 1 Creating Source list file
Step 2 Installing MongoDB
Step 3 Start the Mongo Deamon
Step 4 Configure User for MongoDB
--------------------------------------------------------------
STEP 1 : CREATING SOURCE LIST FILE
Importing the public key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
Creating Souce list File
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
STEP 2 : INSTALLING MONGODB
Update the Repository
sudo apt-get update
Install MongoDB
sudo apt-get install -y mongodb-org
STEP 3 : START THE MONGOd
Start the mongo deamon using the following command
systemctl start mongod
To start mongoDB during Startup
systemctl enable mongod
To Use MongoDB use,
mongo
STEP 4 : CONFIGURE USER FOR MONGODB
In the MongoDB use the following command,
use admin
To create User
db.createUser({user:"username", pwd:"password", roles:[{role:"root", db:"admin"}]})
nano /lib/systemd/system/mongod.service
Add --auth in ExecStart
ExecStart=/usr/bin/mongod --auth --config /etc/mongod.conf
Reload the deamon for updating the user credentials
sudo systemctl daemon-reload
sudo service mongod restart
mongo -u username -p password
Thanks for sharing this wonderful content.its very useful to us.Nice and good article.I gained many unknown information, the way you have clearly explained is really fantastic.keep posting such useful information.
ReplyDeleteFull Stack Training in Chennai | Certification | Online Training Course
Full Stack Training in Bangalore | Certification | Online Training Course
Full Stack Training in Hyderabad | Certification | Online Training Course
Full Stack Developer Training in Chennai | Mean Stack Developer Training in Chennai
Full Stack Training
Full Stack Online Training
This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information
ReplyDeleteMongodb Training in Bangalore