在CentOS上安装MongoDB时出现Yum错误?


8

我正在使用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

Answers:


4

该错误是很明显的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 /


你好,SIM卡感谢您的答复,但在我解决了这些拼写错误并更改为repmod.xml之后,我得到了此错误。请检查我的问题的编辑@sim
hubatrix

@Brewmaster-请检查该URL。仍然不正确。现在,您将/repodata/repomd.xml重复了2次!
slm

@slm:FWIW,yum localinstall由于相当长的时间已被弃用,只需yum install照常使用即可。从手册页:localinstall rpmfile1 [rpmfile2] [...](仅出于遗留原因进行了维护-请使用install
doktor5000

@ doktor5000-谢谢,没有在手册页中注意到这一点。说它会因为遗留原因而被保留,所以应该尽量少使用它,但是将停止告诉ppl使用它8-)。顺便说一句,固定职位。
slm


3

如果您的回购配置很脏,就会发生这种情况。

尝试这个

sudo rm -rf /etc/yum.repos.d/mongod*
sudo yum clean all

然后再次创建仓库

sudo vi /etc/yum.repos.d/mongodb-org-3.4.repo

然后添加:

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

然后运行以下命令:

sudo yum install -y mongodb-org

1

我通过删除/$releaserver链接中的和替换了7Server 解决了此问题,http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/因此请尝试使用此更改替换该链接。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.