MongoDB is one of the document oriented open source database developed in c++, first come into shape in 2007 when in order to overcome the shortfall of existing database while working for an advertising company “DoubleClick” development team has decided to go further rather than struggling with database. The team of this advertising company was frustrated with their existing DB as the team was struggling for scalability and agility both on their existing DB. While facing such issues Dwight Merriman, Eliot Horowitz and Kevin Ryan has got an idea and they took this up further to develop MongoDB.
They have founded MongoDB Inc.
Like any other database MongoDB also supports multi platform. MongoDB Inc. has released many binaries of every version which runs on different platform like OSx, Windows and different flavour of Unix like RedHat, SUSE, Amazon Linux etc. Besides these there are enterprise edition releases as well which also supports on various platform.
MongoDB Inc. has also released Enterprise Edition (EE) of the database. Installation of MongoDB EE, like its operations, is very simple and straight forward. We will take a look here for installation of MongoDB EE on Ubuntu.
Very first step to install any version of MongoDB on any unix platform is to Import the public key used by the package management system. By importing this public key, Ubuntu or any unix package management tools is able to ensure authenticity by requiring that distributors sign packages with GPG keys. Since, the packages are signed by GPG keys, Ubuntu can believe on integrity of these packages as well.
All command is highlighted in yellow color and output of command is in light blue color
sanjeeva@mishika:~$ sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 0C49F3730359A14518585931BC711F9BA15703C6
[sudo] password for sanjeeva:
Executing: /tmp/tmp.ftZSb0MKfI/gpg.1.sh –keyserver
hkp://keyserver.ubuntu.com:80 –recv 0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: “MongoDB 3.4 Release Signing Key <packaging@mongodb.com>” not changed
gpg: Total number processed: 1
gpg: unchanged: 1
sanjeeva@mishika:~$
Once public key are imported into the system, we have to create the list of files for MongoDB. This will be created into “sources.list.d” folder in apt of etc.
sanjeeva@mishika:~$ echo “deb [ arch=amd64,arm64,ppc64el,s390x ] http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
deb [ arch=amd64,arm64,ppc64el,s390x ] http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4 multiverse
sanjeeva@mishika:~$
After creating list of files for MongoDB, we have to reload the local package database. To achieve this we have to execute update on package management tool.
sanjeeva@mishika:~$ sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Ign:4 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4 InRelease
Get:5 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4 Release [5,406 B]
Get:6 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4 Release.gpg [801 B]
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [68.2 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [478 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64×64 Icons [43.1 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [32.1 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64×64 Icons [36.9 kB]
Get:13 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse amd64 Packages [3,552 B]
Get:14 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse arm64 Packages [3,561 B]
Get:15 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse ppc64el Packages [2,925 B]
Get:16 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse s390x Packages [3,564 B]
Get:17 http://in.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [468 kB]
Get:18 http://in.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [188 kB]
Get:19 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [305 kB]
Get:20 http://in.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64×64 Icons [189 kB]
Get:21 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [403 kB]
Get:22 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [397 kB]
Get:23 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [151 kB]
Get:24 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [133 kB]
Get:25 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64×64 Icons [162 kB]
Get:26 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [2,520 B]
Get:27 http://in.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,324 B]
Fetched 3,387 kB in 18s (186 kB/s)
AppStream cache update completed, but some metadata was ignored due to errors.
Reading package lists… Done
sanjeeva@mishika:~$
Now system is ready for installation of MongoDB. By default it will install the latest stable version but we can control this behavior and can install any specific version of database. In case if we want to install any specific version then we have to supply the version of all packages which MongoDB is going to install.
In all cases database is going to install five packages which is required in order to run MongoDB. Details of these packages are:
- mongodb-enterprise :A metapackage that will automatically install the four component packages listed below.
- mongodb-enterprise-server: Contains the mongod daemon and associated configuration and init scripts.
- mongodb-enterprise-mongos: Contains the mongos daemon.
- mongodb-enterprise-shell: Contains the mongo shell.
- mongodb-enterprise-tools: Contains the following MongoDB tools:
- mongoimport
- bsondump,
- mongodump,
- mongoexport,
- mongofiles,
- mongooplog,
- mongoperf,
- mongorestore,
- mongostat, and
- mongotop.
To Install MongoDB EE by Default we have to execute “sudo apt-get” package management tool on Ubuntu.
sanjeeva@mishika:~$ sudo apt-get install -y mongodb-enterprise
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
mongodb-enterprise-mongos mongodb-enterprise-server mongodb-enterprise-shell mongodb-enterprise-tools snmp
The following NEW packages will be installed:
mongodb-enterprise mongodb-enterprise-mongos mongodb-enterprise-server mongodb-enterprise-shell mongodb-enterprise-tools snmp
0 upgraded, 6 newly installed, 0 to remove and 336 not upgraded.
Need to get 75.8 MB of archives.
After this operation, 301 MB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 snmp amd64 5.7.3+dfsg-1ubuntu4 [154 kB]
Get:2 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse amd64 mongodb-enterprise-shell amd64 3.4.2 [8,446 kB]
Get:3 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse amd64 mongodb-enterprise-server amd64 3.4.2 [14.6 MB]
Get:4 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse amd64 mongodb-enterprise-mongos amd64 3.4.2 [8,230 kB]
Get:5 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse amd64 mongodb-enterprise-tools amd64 3.4.2 [44.4 MB]
59% [5 mongodb-enterprise-tools 11.9 MB/44.4 MB 27%] 140 kB/s 3min 51s
59% [5 mongodb-enterprise-tools 12.0 MB/44.4 MB 27%] 140 kB/s 3min 51s
Get:6 http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4/multiverse amd64 mongodb-enterprise amd64 3.4.2 [3,572 B]
Fetched 75.8 MB in 7min 2s (179 kB/s)
Selecting previously unselected package mongodb-enterprise-shell.
(Reading database … 172652 files and directories currently installed.)
Preparing to unpack …/mongodb-enterprise-shell_3.4.2_amd64.deb …
Unpacking mongodb-enterprise-shell (3.4.2) …
Selecting previously unselected package snmp.
Preparing to unpack …/snmp_5.7.3+dfsg-1ubuntu4_amd64.deb …
Unpacking snmp (5.7.3+dfsg-1ubuntu4) …
Selecting previously unselected package mongodb-enterprise-server.
Preparing to unpack …/mongodb-enterprise-server_3.4.2_amd64.deb …
Unpacking mongodb-enterprise-server (3.4.2) …
Selecting previously unselected package mongodb-enterprise-mongos.
Preparing to unpack …/mongodb-enterprise-mongos_3.4.2_amd64.deb …
Unpacking mongodb-enterprise-mongos (3.4.2) …
Selecting previously unselected package mongodb-enterprise-tools.
Preparing to unpack …/mongodb-enterprise-tools_3.4.2_amd64.deb …
Unpacking mongodb-enterprise-tools (3.4.2) …
Selecting previously unselected package mongodb-enterprise.
Preparing to unpack …/mongodb-enterprise_3.4.2_amd64.deb …
Unpacking mongodb-enterprise (3.4.2) …
Processing triggers for man-db (2.7.5-1) …
Setting up mongodb-enterprise-shell (3.4.2) …
Setting up snmp (5.7.3+dfsg-1ubuntu4) …
Setting up mongodb-enterprise-server (3.4.2) …
Setting up mongodb-enterprise-mongos (3.4.2) …
Setting up mongodb-enterprise-tools (3.4.2) …
Setting up mongodb-enterprise (3.4.2) …
sanjeeva@mishika:~$
sanjeeva@mishika:~$
Once installation is complete, MongoDB EE can be started:
sanjeeva@mishika:~$ sudo service mongod start
You can connect to the MongoDB EE now.
sanjeeva@mishika:~$ mongo
MongoDB shell version v3.4.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.2
Server has startup warnings:
2017-02-22T21:32:46.078+0530 I STORAGE [initandlisten]
2017-02-22T21:32:46.078+0530 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-02-22T21:32:46.078+0530 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-02-22T21:32:46.161+0530 I CONTROL [initandlisten]
2017-02-22T21:32:46.161+0530 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-02-22T21:32:46.161+0530 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-02-22T21:32:46.161+0530 I CONTROL [initandlisten]
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten]
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten]
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2017-02-22T21:32:46.162+0530 I CONTROL [initandlisten]
MongoDB Enterprise >