Linux

在 CentOS 上安裝 MongoDB 時出現 Yum 錯誤?

  • November 20, 2019

我正在使用 Centos 6.6 (x86_64) 嘗試安裝最穩定的 mongodb 版本。但我被這個錯誤困住了(這似乎是重複的,但以前的答案都沒有對我有用)

[root@localhost home]# sudo yum install -y mongodb-org
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: centos.01link.hk
http://repo.mongodb.org/yum/redhat/%24releaserver/mongodb-org/3.0/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: mongodb-org-3.0. Please verify its path and try again

我的回購:

vim /etc/yum.repos.d/mongodb-org-3.0.repo

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releaserver/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1

試過了

yum clean all
yum check
yum erase apf
yum erase upgrade 

也試過

sudo sed -i 's/https/http/g' /etc/yum.repos.d/mongodb-org-3.0.repo

我的 yum.conf

[root@localhost home]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=19&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[root@localhost home]# 

請幫我解決這個問題!

我也設置了 SELinux=permissive 在修復了 sim 指出的錯誤後,我收到以下錯誤

[root@localhost Hubatrix]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base extras mongodb-org-3.0 updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@localhost Hubatrix]# cat /etc/yum.repos.d/mongodb-org-3.0.repo
[mongodb-org-3.0]
name=MongoDB Repository 
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/repodata/repomd.xml
gpgcheck=0
enabled=1

[root@localhost Hubatrix]# sudo yum install -y mongodb-org
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Determining fastest mirrors
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
base                                                                                                                          | 3.7 kB     00:00     
base/primary_db                                                                                                               | 4.6 MB     01:21     
extras                                                                                                                        | 3.4 kB     00:00     
extras/primary_db                                                                                                             |  31 kB     00:00     
https://repo.mongodb.org/yum/redhat/6/mongodb-org/3.0/x86_64/repodata/repomd.xml/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: mongodb-org-3.0. Please verify its path and try again

錯誤很明顯yum

http://repo.mongodb.org/yum/redhat/%24releaserver/mongodb-org/3.0/x86_64/repodata/repomd.xml :

$$ Errno 14 $$PYCURL 錯誤 22 - “請求的 URL 返回錯誤:404 未找到”

該 URL 的另一端沒有可供yum下載的文件,因此是 404。將該 URL 放入瀏覽器並開始導航以查看實際存在的文件。

當我瀏覽他們的倉庫時,這是正確的 URL:

我懷疑他們移動了東西,但沒有重新生成 repomd.xml 文件。您可以通過手動下載軟體包然後使用yum install ..來安裝東西來解決此問題。

錯字

但我認為你的回購文件中有一個錯字:

baseurl= https://repo.mongodb.org/yum/redhat/ $releaserver/mongodb-org/3.0/x86_64/

應該是這樣的:

baseurl= https://repo.mongodb.org/yum/redhat/ $releasever/mongodb-org/3.0/x86_64/

引用自:https://unix.stackexchange.com/questions/217083