How to install mongodb in ubuntu 15.04
Step 1: If you install any packages of mongodb yet, firstly remove all.
To remove all existing packages execute the below command:
sudo apt-get purge mongodb-org
sudo apt-get autoremoveRemove the old mongodb source list you created in below folder.sudo rm /etc/apt/sources.list.d/
Remove db and logs:
sudo rm -r /var/lib/mongodbsudo rm -r /var/log/mongodbStep 2: Add debian repository: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
Step 3: Update and install:sudo apt-get update
sudo apt-get install -y mongodb-orgStep 4: Start mongo db:sudo service mongod start
or
systemctl start mongod Step 5: Configure MongoDB username and password:
open mongo shell:
(cntrl+alt+t) open termianl and type >
mongo
then the shell is open.
then switch the database typing>
use admin
then Create the root user with this command >
db.createUser({user:"admin", pwd:"admin123", roles:[{role:"root", db:"admin"}]})
Enjoy........
Comments
Post a Comment