Install the MongoDB 2.6 tutorial using yum on the CentOS 6.5 system

  • 2020-05-13 03:45:01
  • OfStack

Let's install the latest version of MongoDB 2.6.0 on CentOS 6.5 x64.

MongoDB v2.4.x version of the software warehouse has two packages:

1) mongo - 10 gen - server
This package contains the latest versions of the mongod and mongos daemons as well as the associated configuration and initialization scripts.

2) mongo - 10 gen
This package contains the latest version of all the MongoDB tools. These tools allow you to manage your MongoDB system.

However, there are 5 packages in MongoDB v2.6.0 software warehouse 1:

1) mongodb - org
This package is a meta-package that automatically installs the following four component packages.
2) mongodb org -- server
This package contains the mongod daemon, along with the associated configuration and initialization scripts.
3) mongodb org -- mongos
This package contains the mongos daemon.
4) mongodb org -- shell
This package contains the 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 script: mongodb - org package there are all kinds of control script, including the initialization scripts/etc/rc d/init d/mongod
Configure MongoDB using the /etc/ mongod.conf configuration file.

MongoDB 2.6.0 no longer has the mongos control script. The mongos process is only used for sharding scenarios. You can use the mongod initialization script to drive the mongos control script.

To install the latest 64-bit MongoDB version 2.6.0, follow these steps:

1. Create mongodb.repo

In/etc yum. repos. d/directory to create file mongodb repo, it contains MongoDB configuration information of the warehouse, the content is as follows:


[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1 2 Execute the 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                                                    |  19 kB     00:00    
mongodb                                                              |  951 B     00:00    
mongodb/primary                                                      |  24 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 will 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 will be installed
---> Package mongodb-org-server.x86_64 0:2.6.0-1 will be installed
---> Package mongodb-org-shell.x86_64 0:2.6.0-1 will be installed
---> Package mongodb-org-tools.x86_64 0:2.6.0-1 will 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            88 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


$ sudo service mongod start

5. Verify MongoDB
Can check the log file/var/log/mongodb/mongod log to determine the content of the mongod process is running correctly.
You can also execute commands:


$ sudo chkconfig mongod on

To stop MongoDB, execute:

$ sudo service mongod stop

To restart MongoDB, execute:

$ sudo service mongod restart


Related articles: