mongodb - 无法打开文件 /packages/repodata/repomd.xml
问题描述
我正在使用 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
我该如何解决这个错误?
解决方案
根据您的错误消息,您似乎遇到了名称服务器问题,这可能涉及各种解决方案,正如redhat.com 的这个答案所描述的那样。我的mongodb-org-4.0.repo
文件看起来和你的一样,除了版本 4.4 并且一切正常。好吧,起初我不是这样找到这篇文章的,但我的问题是我不小心在文件末尾插入了一个空格mongodb-org-4.4.repo
。
我发现这个Unix & Linux Stack Exchange帖子有一些可能的修复,其中之一是更新到最新的 CentOS。这个ServerFault帖子也有一个 Errno 14 错误消息,就像你看到的那样,但这个解决方案是禁用 SELinux。
推荐阅读
- flutter - 如何用 Flutter 做这个底页?
- jenkins - 关于 Jenkins BitBucket 使用管道和管道脚本的问题,但在将新数据推送到 bitbucket 时也会运行
- node.js - macOS 10.13 brew install node@14 问题
- node.js - Express JS - 如果 MongoDB id 不存在则重定向/错误 [ERR_HTTP_HEADERS_SENT]:在将标头发送到客户端后无法设置标头
- vbscript - 手术失败。错误(62)输入超过文件结尾
- c++ - 在这种情况下比较字符串的工作方式不同,有什么原因吗?
- python-3.x - 批处理 Python Asyncio 和性能审查
- wordpress - Nginx 上的基本干净 wordpress 安装返回 502 错误
- wordpress - 自动化 Woocommerce - 结帐时 opti 的位置
- java - CodenameOne - 修复 SimpleDateFormat XXX 格式字符串以具有 ISO 时区