今天在CentOS7下运行YUM安装的时候出现以下问题
[root@iz2ze6u0apce8jpapxeubpz mongodb]# yum -y install mongodb-org
Loaded plugins: fastestmirror
File contains no section headers.
file: file:///etc/yum.repos.d/mongodb-org-3.4.repo, line: 2
'ngodb-org-3.4] \n'
在网上找了半天,最后发现是《配置MongoDB的yum》源 出问题了
[root@iz2ze6u0apce8jpapxeubpz mongodb]# vim /etc/yum.repos.d/mongodb-org-3.4.repo
在修改之前我的文件内容是这样的:
ngodb-org-3.4]
name=MongoDB_Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
修改之后应该是:
[mongodb-org-3.4]
name=MongoDB_Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
之后再执行,发现成功了:
[root@iz2ze6u0apce8jpapxeubpz mongodb]# yum -y install mongodb-org
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.4.6-1.el7 will be installed
--> Processing Dependency: mongodb-org-tools = 3.4.6 for package: mongodb-org-3.4.6-1.el7.x86_64
--> Processing Dependency: mongodb-org-shell = 3.4.6 for package: mongodb-org-3.4.6-1.el7.x86_64
--> Processing Dependency: mongodb-org-server = 3.4.6 for package: mongodb-org-3.4.6-1.el7.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.4.6 for package: mongodb-org-3.4.6-1.el7.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.4.6-1.el7 will be installed
---> Package mongodb-org-server.x86_64 0:3.4.6-1.el7 will be installed
---> Package mongodb-org-shell.x86_64 0:3.4.6-1.el7 will be installed
---> Package mongodb-org-tools.x86_64 0:3.4.6-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
mongodb-org x86_64 3.4.6-1.el7 mongodb-org-3.4 5.8 k
Installing for dependencies:
mongodb-org-mongos x86_64 3.4.6-1.el7 mongodb-org-3.4 12 M
mongodb-org-server x86_64 3.4.6-1.el7 mongodb-org-3.4 20 M
mongodb-org-shell x86_64 3.4.6-1.el7 mongodb-org-3.4 11 M
mongodb-org-tools x86_64 3.4.6-1.el7 mongodb-org-3.4 49 M
Transaction Summary
=======================================================================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 91 M
Installed size: 258 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mongodb-org-3.4/packages/mongodb-org-3.4.6-1.el7.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID a15703c6: NOKEY 0 B --:--:-- ETA
Public key for mongodb-org-3.4.6-1.el7.x86_64.rpm is not installed
(1/5): mongodb-org-3.4.6-1.el7.x86_64.rpm | 5.8 kB 00:00:01
(2/5): mongodb-org-mongos-3.4.6-1.el7.x86_64.rpm | 12 MB 00:00:03
(3/5): mongodb-org-shell-3.4.6-1.el7.x86_64.rpm | 11 MB 00:00:01
(4/5): mongodb-org-server-3.4.6-1.el7.x86_64.rpm | 20 MB 00:00:05
(5/5): mongodb-org-tools-3.4.6-1.el7.x86_64.rpm | 49 MB 00:00:16
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 4.3 MB/s | 91 MB 00:00:21
Retrieving key from https://www.mongodb.org/static/pgp/server-3.4.asc
Importing GPG key 0xA15703C6:
Userid : "MongoDB 3.4 Release Signing Key "
Fingerprint: 0c49 f373 0359 a145 1858 5931 bc71 1f9b a157 03c6
From : https://www.mongodb.org/static/pgp/server-3.4.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mongodb-org-shell-3.4.6-1.el7.x86_64 1/5
Installing : mongodb-org-tools-3.4.6-1.el7.x86_64 2/5
Installing : mongodb-org-mongos-3.4.6-1.el7.x86_64 3/5
Installing : mongodb-org-server-3.4.6-1.el7.x86_64 4/5
Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service.
Installing : mongodb-org-3.4.6-1.el7.x86_64 5/5
Verifying : mongodb-org-3.4.6-1.el7.x86_64 1/5
Verifying : mongodb-org-server-3.4.6-1.el7.x86_64 2/5
Verifying : mongodb-org-mongos-3.4.6-1.el7.x86_64 3/5
Verifying : mongodb-org-tools-3.4.6-1.el7.x86_64 4/5
Verifying : mongodb-org-shell-3.4.6-1.el7.x86_64 5/5
Installed:
mongodb-org.x86_64 0:3.4.6-1.el7
Dependency Installed:
mongodb-org-mongos.x86_64 0:3.4.6-1.el7 mongodb-org-server.x86_64 0:3.4.6-1.el7 mongodb-org-shell.x86_64 0:3.4.6-1.el7 mongodb-org-tools.x86_64 0:3.4.6-1.el7
Complete!
[root@iz2ze6u0apce8jpapxeubpz mongodb]#