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 autoremove

Remove 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/mongodb
sudo rm -r /var/log/mongodb
Step 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-org

Step 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

Popular posts from this blog

How to run ofbiz as ubuntu Service.

JPA vs Spring JPA vs Spring Data JPA vs Hibernate

Java Array Interview Questions for Entry-Level Developers Part 01