无法打开文件/packages/repodata/repomd.xml

时间:2019-04-01 18:25:24

标签: mongodb

我正在使用Redhat Linux服务器并尝试在其上安装MongoDB。

我正在按照链接中给出的步骤操作:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

步骤1 :创建一个/etc/yum.repos.d/mongodb-org-4.0.repo文件,以便您可以使用yum直接安装MongoDB。

sudo nano /etc/yum.repos.d/mongodb-org-4.0.repo

第2步:将以下代码复制并粘贴到新创建的文件中。

[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

步骤3 :要安装特定版本的MongoDB,请分别指定每个组件包,并将版本号附加到包名中,如以下示例所示:

sudo yum install -y mongodb-org

所有这些之后,我得到以下错误:

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
file:///packages/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /packages/repodata/repomd.xml"
Trying other mirror.`


One of the configured repositories failed (local),
and yum doesn't have enough cached data to continue. At this point the only 
safe thing yum can do is fail. There are a few ways to work "fix" this:`

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=localrepo ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable localrepo
    or
        subscription-manager repos --disable=localrepo

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=localrepo.skip_if_unavailable=true

failure: repodata/repomd.xml from localrepo: [Errno 256] No more mirrors to try.
file:///packages/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /packages/repodata/repomd.xml"

服务器操作系统

NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"

我已经按照以下步骤操作,但是在我的情况下这些操作不起作用:

sudo rm -rf /etc/yum.repos.d/mongodb-org-4.0.repo

sudo yum clean all

我该如何解决此错误?

2 个答案:

答案 0 :(得分:0)

您应该在/etc/yum.repos.d/mongodb-org-4.0.repo文件中使用 baseurl 进行检查。我们还可以在baseurl中更改releaseserver版本。

这是我的/etc/yum.repos.d/mongodb-org-4.0.repo文件

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

对我有用。

答案 1 :(得分:0)

根据您的错误消息,您似乎遇到了域名服务器问题,该问题可能涉及到answer from redhat.com所描述的各种解决方案。我的mongodb-org-4.0.repo文件看起来与您的文件相似,但版本4.4除外,并且一切正常。嗯,起初并不是我找到这篇文章的方式,但是我的问题是我不小心在mongodb-org-4.4.repo文件末尾插入了一个空格。

我发现这篇Unix & Linux Stack Exchange帖子中包含一些可能的修复程序,其中之一正在更新到最新的CentOS。这则ServerFault帖子也有您看到的Errno 14错误消息,但是此解决方案是禁用SELinux。