How to Install MongoDB 3.2 on Ubuntu 14.04, 12.04 and Debian 7
MongoDB (named from “huMONGOus “) is a full flexible index support and rich queries database. Its is a NoSQL database. MongoDB provides large media storage with GridFS. MongoDB 3.2 introduces new storage engines that extend the capabilities of the database. Click Here for more details about this version of MongoDB.
Adding Apt Repository
First import public key of MongoDB apt repository in our system using following command.
root@hackthesec:~# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Lets add MongoDB APT repository url in /etc/apt/sources.list.d/mongodb.list.
For Ubuntu:
root@hackthesec:~# echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list
For Debian:
root@hackthesec:~# echo "deb http://repo.mongodb.org/apt/debian "$(lsb_release -sc)"/mongodb-org/3.2 main" | sudo tee /etc/apt/sources.list.d/mongodb.list
Install MongoDB
After adding required APT repositories, use following commands to install MongoDB in your systems. It will also install all dependent packages required for mongodb.
root@hackthesec:~# sudo apt-get update root@hackthesec:~# sudo apt-get install mongodb-org
If you want to install any specific version of MontoDB, define the version number like below
root@hackthesec:~# apt-get install mongodb-org=3.2.0 mongodb-org-server=3.2.0 mongodb-org-shell=3.2.0 mongodb-org-mongos=3.2.0 mongodb-org-tools=3.2.0
Start MongoDB Service
After installation MongoDB will start automatically. To start or stop MongoDB use init script. Below are the example commands to do.
root@hackthesec:~# sudo service mongod start root@hackthesec:~# sudo service mongod stop
Verify MongoDB Installation
Finally use the below command to check installed MongoDB version on your system.
root@hackthesec:~#mongod --version db version v3.2.0 git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7 OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014 allocator: tcmalloc modules: none build environment: distmod: ubuntu1404 distarch: x86_64 target_arch: x86_64
Also connect MongoDB using command line and execute some test commands for checking proper working.
root@hackthesec:~# mongo
> use mydb;
> db.test.save( { hackthesec: 100 } )
> db.test.find()
{ "_id" : ObjectId("55c1dc8433d8as53471cgh4dad"), "hackthesec" : 100 }
Hack The Security Hack The Sec Twitter
0 comments:
Post a Comment