MongoDB 基础(2)

2021-10-19 16:10:30 浏览数 (1)

安装软件

代码语言:javascript复制
[root@h105 yum.repos.d]# yum clean all 
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Cleaning repos: base epel extras mongodb-org-3.2 updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@h105 yum.repos.d]# yum install -y mongodb-org
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Repository base is listed more than once in the configuration
Determining fastest mirrors
epel/metalink                                                                                                  | 3.3 kB
 * epel: mirror.pregi.net
 * extras: mirrors.aliyun.com
 * updates: mirrors.skyshe.cn
base                                                                                                           | 4.0 kB
base/primary_db                                                                                                | 4.5 MB
epel                                                                                                           | 4.3 kB
epel/primary_db                                                                                                | 5.9 MB
extras                                                                                                         | 3.4 kB
extras/primary_db                                                                                              |  37 kB
mongodb-org-3.2                                                                                                | 2.5 kB
mongodb-org-3.2/primary_db                                                                                     |  33 kB
updates                                                                                                        | 3.4 kB
updates/primary_db                                                                                             | 5.2 MB
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.2.6-1.el6 will be installed
--> Processing Dependency: mongodb-org-tools = 3.2.6 for package: mongodb-org-3.2.6-1.el6.x86_64
--> Processing Dependency: mongodb-org-shell = 3.2.6 for package: mongodb-org-3.2.6-1.el6.x86_64
--> Processing Dependency: mongodb-org-server = 3.2.6 for package: mongodb-org-3.2.6-1.el6.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.2.6 for package: mongodb-org-3.2.6-1.el6.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.2.6-1.el6 will be installed
---> Package mongodb-org-server.x86_64 0:3.2.6-1.el6 will be installed
---> Package mongodb-org-shell.x86_64 0:3.2.6-1.el6 will be installed
---> Package mongodb-org-tools.x86_64 0:3.2.6-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================
 Package                              Arch                     Version                        Repository               
=======================================================================================================================
Installing:
 mongodb-org                          x86_64                   3.2.6-1.el6                    mongodb-org-3.2          
Installing for dependencies:
 mongodb-org-mongos                   x86_64                   3.2.6-1.el6                    mongodb-org-3.2          
 mongodb-org-server                   x86_64                   3.2.6-1.el6                    mongodb-org-3.2          
 mongodb-org-shell                    x86_64                   3.2.6-1.el6                    mongodb-org-3.2          
 mongodb-org-tools                    x86_64                   3.2.6-1.el6                    mongodb-org-3.2          

Transaction Summary
=======================================================================================================================
Install       5 Package(s)

Total download size: 65 M
Installed size: 206 M
Downloading Packages:
(1/5): mongodb-org-3.2.6-1.el6.x86_64.rpm                                                                      | 5.8 kB
(2/5): mongodb-org-mongos-3.2.6-1.el6.x86_64.rpm                                                               | 6.0 MB
(3/5): mongodb-org-server-3.2.6-1.el6.x86_64.rpm                                                               |  13 MB
(4/5): mongodb-org-shell-3.2.6-1.el6.x86_64.rpm                                                                | 7.3 MB
(5/5): mongodb-org-tools-3.2.6-1.el6.x86_64.rpm                                                                |  38 MB
-----------------------------------------------------------------------------------------------------------------------
Total                                                                                                 499 kB/s |  65 MB
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID ea312927: NOKEY
Retrieving key from https://www.mongodb.org/static/pgp/server-3.2.asc
Importing GPG key 0xEA312927:
 Userid: "MongoDB 3.2 Release Signing Key <packaging@mongodb.com>"
 From  : https://www.mongodb.org/static/pgp/server-3.2.asc
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mongodb-org-server-3.2.6-1.el6.x86_64                                                                   
  Installing : mongodb-org-mongos-3.2.6-1.el6.x86_64                                                                   
  Installing : mongodb-org-tools-3.2.6-1.el6.x86_64                                                                    
  Installing : mongodb-org-shell-3.2.6-1.el6.x86_64                                                                    
  Installing : mongodb-org-3.2.6-1.el6.x86_64                                                                          
  Verifying  : mongodb-org-shell-3.2.6-1.el6.x86_64                                                                    
  Verifying  : mongodb-org-tools-3.2.6-1.el6.x86_64                                                                    
  Verifying  : mongodb-org-mongos-3.2.6-1.el6.x86_64                                                                   
  Verifying  : mongodb-org-server-3.2.6-1.el6.x86_64                                                                   
  Verifying  : mongodb-org-3.2.6-1.el6.x86_64                                                                          

Installed:
  mongodb-org.x86_64 0:3.2.6-1.el6                                                                                     

Dependency Installed:
  mongodb-org-mongos.x86_64 0:3.2.6-1.el6     mongodb-org-server.x86_64 0:3.2.6-1.el6     mongodb-org-shell.x86_64 0:3.
  mongodb-org-tools.x86_64 0:3.2.6-1.el6     

Complete!
[root@h105 yum.repos.d]#
[root@h105 yum.repos.d]# mongo --version
MongoDB shell version: 3.2.6
[root@h105 yum.repos.d]# 

Tip: mongodb-org 其实本身不包含任何逻辑代码,只是利用 rpm 的 spec 文件在指定依赖,这样只用安装一个 mongodb-org ,yum 就会自动去将其依赖的 mongodb-org-mongos、mongodb-org-server、mongodb-org-shell、mongodb-org-tools 都给装上,简化了安装过程

Tip: 要查看这个包的依赖关系可以使用 yum deplist mongodb-org

Note: SELinux 可能妨碍 mongodb 的正常工作,要关掉

代码语言:javascript复制
[root@h105 ~]# getenforce 
Disabled
[root@h105 ~]# grep -i '^SELINUX' /etc/sysconfig/selinux 
SELINUX=disabled
SELINUXTYPE=targeted 
[root@h105 ~]# 

0 人点赞