Below we install the latest MongoDB 2.6.0 version on the CentOS 6.5 x64 system.
The MongoDB v2.4.x version of the software warehouse has two packages:
1) mongo-10gen-server
This package contains the latest version of the Mongod and MONGOs daemons and associated configuration and initialization scripts.
2) Mongo-10gen
This package has all the MongoDB tools in the latest edition. These tools make it easy for you to manage MongoDB systems.
However, in the MongoDB v2.6.0 version of the software warehouse a total of five packages:
1) mongodb-org
This package is a metadata package that implements the 4 component packages that are installed automatically below.
2) Mongodb-org-server
This package contains Mongod daemons, as well as related configuration and initialization scripts.
3) Mongodb-org-mongos
There is a MONGOs daemon in this package.
4) Mongodb-org-shell
This package contains a MONGO shell environment.
5) Mongodb-org-tools
This package contains the following MongoDB tools: Mongoimport, Bsondump, Mongodump, Mongoexport, Mongofiles, Mongoimport, Mongooplog, Mongoperf, Mongorestore, Mongostat and Mongotop.
Control scripts: The mongodb-org package contains various control scripts, including initialization scripts/etc/rc.d/init.d/mongod
Use the/etc/mongod.conf configuration file to configure the MongoDB.
The MongoDB 2.6.0 version no longer has a MONGOs control script. The MONGOs process is used only for fragmented scenarios. You can use Mongod initialization scripts to drive MONGOs control scripts.
To install the latest 64-bit MongoDB 2.6.0 version, follow these steps:
1. Create Mongodb.repo files
Create a file Mongodb.repo in the/etc/yum.repos.d/directory that contains configuration information for the MongoDB warehouse, as follows:
Copy Code code as follows:
[MongoDB]
Name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
Gpgcheck=0
Enabled=1
2. Execute installation command
$ sudo yum install mongodb-org
Loaded plugins:security
Base | 3.7 KB 00:00
base/primary_db | 4.4 MB 00:01
Extras | 3.4 KB 00:00
extras/primary_db | MB 00:00
MongoDB | 951 B 00:00
Mongodb/primary | KB 00:16
MongoDB 155/155
Openlogic | 1.3 KB 00:00
Openlogic/primary | 273 KB 00:00
Openlogic 24/24
Updates | 3.4 KB 00:00
updates/primary_db | 2.6 MB 00:00
Setting up Install Process
Resolving dependencies
--> Running Transaction Check
---> Package mongodb-org.x86_64 0:2.6.0-1 would be installed
--> processing dependency:mongodb-org-tools = 2.6.0 for package:mongodb-org-2.6.0-1.x86_64
--> processing Dependency:mongodb-org-shell = 2.6.0 for package:mongodb-org-2.6.0-1.x86_64
--> processing dependency:mongodb-org-server = 2.6.0 for package:mongodb-org-2.6.0-1.x86_64
--> processing Dependency:mongodb-org-mongos = 2.6.0 for package:mongodb-org-2.6.0-1.x86_64
--> Running Transaction Check
---> Package mongodb-org-mongos.x86_64 0:2.6.0-1 would be installed
---> Package mongodb-org-server.x86_64 0:2.6.0-1 would be installed
---> Package mongodb-org-shell.x86_64 0:2.6.0-1 would be installed
---> Package mongodb-org-tools.x86_64 0:2.6.0-1 would be installed
--> finished Dependency resolution
Dependencies resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
mongodb-org x86_64 2.6.0-1 MongoDB 4.6 k
Installing for dependencies:
Mongodb-org-mongos x86_64 2.6.0-1 MongoDB 6.8 M
Mongodb-org-server x86_64 2.6.0-1 MongoDB 8.9 M
Mongodb-org-shell x86_64 2.6.0-1 MongoDB 4.2 M
Mongodb-org-tools x86_64 2.6.0-1 MongoDB M
Transaction Summary
============================================================================================
Install 5 Package (s)
Total Download size:108 M
Installed size:274 M
Is this OK [y/n]: Y
......
3. Configure SELinux Firewall
Open Port 27017
4, Start MongoDB
Copy Code code as follows:
$ sudo service mongod start
5. Verify MongoDB
you can determine whether the Mongod process is working correctly by examining the contents of the log file/var/log/mongodb/mongod.log.
You can also execute commands:
Copy Code code as follows:
$ sudo chkconfig mongod on
To stop MongoDB, execute:
Copy Code code as follows:
$ sudo service Mongod stop
To reboot the MongoDB, execute:
Copy Code code as follows:
$ sudo service mongod restart