在AWS linux上通过yum安装MongoDB失败:HTTPS错误404 - 未找到

时间:2017-06-13 09:17:05

标签: linux mongodb amazon yum

我尝试按照MongoDB Doc上的步骤在我的服务器上通过yum安装mongodb@3.4。首先,我在 /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 mongodb-org,但收到了错误。

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                             | 2.1 kB     00:00
amzn-updates                          | 2.3 kB     00:00
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.



One of the configured repositories failed (MongoDB),
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. Disable the repository, 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 mongodb-org-3.4

4. 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=mongodb-org-3.4.skip_if_unavailable=true

failure: repodata/repomd.xml from mongodb-org-3.4: [Errno 256] No more mirrors to try.
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

之后,我尝试yum repolist并发现 MongoDB 的状态为0。

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main                             | 2.1 kB     00:00
amzn-updates                          | 2.3 kB     00:00
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
nodesource/x86_64                     | 2.5 kB     00:00
repo id                repo name                       status
amzn-main/latest       amzn-main-Base                  5,668
amzn-updates/latest    amzn-updates-Base                 435
mongodb-org-3.4/latest MongoDB                             0
nodesource/x86_64      Node.js Packages for Enterprise    61
repolist: 6,164 

我想知道这个回购是否仍然有效?谢谢〜

这是我的服务器操作系统版本:

NAME="Amazon Linux AMI"
VERSION="2017.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.03"
PRETTY_NAME="Amazon Linux AMI 2017.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2017.03

3 个答案:

答案 0 :(得分:13)

请试试这个,

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

sudo yum clean all

再次创建repo文件

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 :(得分:0)

更新至2018年3月

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

添加(或替换)mongo repo配置:

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

现在,您已经能够

yum repolist

sudo yum install -y mongodb-org

答案 2 :(得分:0)

我认为您尝试从exclude添加/etc/yum.conf目录以防止将来进行更新 例如:

exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

但是在执行安装mongodb-org之后需要添加以上行:

sudo yum install -y mongodb-org

因此,从exclude删除/etc/yum.conf行以使mongodb-org软件包可用