This post will help you out installing NoSQL mongoDB on
BOSS GNU/Linux ( Debian-based Linux distribution ).
BOSS version 4.0 & 5.0
latest version of mongoDB (2.4)
1) Import GPG key
root@boss[bin]#apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
10gen package authenticated and it so require GPG key.
2) Create mongoDB 10gen package
root@boss[bin]#echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list
above command will create the file which contain package location latest version of mongoDB.
3) Updates the package lists from a server
root@boss[bin]#sudo apt-get update
re-synchronize the package index files from their sources.
it may throw error, if the GPG key not imported properly
.......
.......
: GPG error: http://downloads-distro.mongodb.org dist Release:
The following signatures couldn't be verified because the public key is not available:
NO_PUBKEY 9ECBEC467F0CEB10
note : in our BOSS version 4.0 & 5.0 , mongoDB successfully installed and running even if the key not imported properly.
4) Installing mongoDB
root@boss[bin]#sudo apt-get install mongodb-10gen
latest version of mongoDB automatically installed.
....
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
libboost-dev: Depends: libboost1.49-dev but it is not installable
mongodb: Depends: mongodb-dev but it is not going to be installed
Depends: mongodb-server (>= 1:2.4.1-2) but it is not going to be installed
mongodb-10gen: Conflicts: mongodb but 1:2.4.3-1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
4.1) Install any dependencies that your previous installs missed.
in our above command, installation not succeed because of missing dependencies
mongodb-dev & mongodb-server. issue the blow command to install those depends.
root@boss[bin]#apt-get -f install
.......
.......
Install these packages without verification [y/N]? y
Get:1 http://downloads-distro.mongodb.org dist/10gen mongodb-10gen 2.4.4 [86.8MB]
Fetched 86.8MB in 18s (4,718kB/s)
Selecting previously deselected package mongodb-10gen.
(Reading database ... 154044 files and directories currently installed.)
Unpacking mongodb-10gen (from .../mongodb-10gen_2.4.4_i386.deb) ...
Processing triggers for man-db ...
Setting up mongodb-10gen (2.4.4) ...
insserv: warning: script 'K01postgresql-9.0' missing LSB tags and overrides
insserv: warning: script 'K01EnterpriseDBApachePhp' missing LSB tags and overrides
insserv: warning: script 'postgresql-9.0' missing LSB tags and overrides
insserv: warning: script 'EnterpriseDBApachePhp' missing LSB tags and overrides
Starting database: mongodb.
by issuing above command mongoDB server installed & started successfully.
5) Know the location of config file
root@boss[bin]#ps -ef | grep mongo
mongodb 14603 1 0 10:53 ? 00:00:00 /usr/bin/mongod --config /etc/mongodb.conf
root 14655 18627 0 10:54 pts/3 00:00:00 grep mongo
also use
5.1)Get the running instance of mongoDB
root@boss[bin]#ps -A | grep mongo
14603 ? 00:00:00 mongod
5.2) Get the binary executable location of mongoDB
root@boss[bin]#whereis mongo
mongo: /usr/bin/mongo /usr/share/man/man1/mongo.1.gz
by issuing above command we can come to know, the
- mongo server running on PID 14603
- All binary file available under /usr/bin directory.
- config file under /etc/mongodb.conf
6) Controlling mangoDB
starting mongoDB
root@boss[bin]#/etc/init.d/mongodb strat
Starting database: mongodb.
get the status
root@boss[bin]#/etc/init.d/mongodb status
Checking status of database: mongodb running..
stopping mongoDB
root@boss[bin]#/etc/init.d/mongodb stop
Stopping database: mongodb.
7) Running mongo
root@boss[bin]#mongo
MongoDB shell version: 2.4.4
connecting to: test
> db
test
>
by default its connecting
test database.
command
"db" will return the current connected database, you can switch to any database by
"use dbname"
note : here I logged in as root user, use
sudo if you logged in an other then root user.
BOSS - Bharat Operating System Solution.