Friday, October 25, 2013

MongoDB Installation on Ubuntu

  • Open Terminal and issue the below command to install the MongoDB on Ubuntu
    • apt-get install mongodb
  • Else download the tar file from the following location and untarEnable Authentication
  • Start/Stop the MongoDB
    • /etc/init.d/mongodb start/stop/restart
  • Adding User MongoDB
    • root@AX-PENTAHO:/usr/local# mongo
    • MongoDB shell version: 2.2.2
    • connecting to: test
    • > use admin;
    • switched to db admin
    • > db.addUser('admin','test123');
    • {
    • "user" : "admin",
    • "readOnly" : false,
    • "pwd" : "3ebea24ef5a0388efc523a0cb1ed54d1",
    • "_id" : ObjectId("5100f5ffb6b86baa08f17ff5")
    • }
  • Login to MongoDB using Admin Login
    • root@AX-PENTAHO:/usr/local# mongo
    • MongoDB shell version: 2.2.2
    • connecting to: test
    • > use admin
    • switched to db admin
    • > db.db.auth('admin','Amtex123');
    • Thu Jan 24 14:22:00 TypeError: db.db.auth is not a function (shell):1
    • > db.auth('admin','Amtex123');
    • 1
    • > exit
  • Listen MongoDB to all IP's
    • vim /etc/mongodb.conf
    • Change bind_ip = 127.0.0.1 to bind_ip = 0.0.0.0

0 comments:

Post a Comment