Centos
CentOS 7 - yum 不會安裝 mongodb
我正在嘗試安裝由MongoDB指導的 mongodb v3.4 。
首先我創建“/etc/yum.repo.d/mongodb.repo”,然後我將這個 repo 資訊粘貼到文件中:
[mongodb-org-3.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
我嘗試安裝 mongodb-org,但我從 yum 收到以下錯誤:
Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden Trying other mirror. To address this issue please refer to the below knowledge base article https://access.redhat.com/solutions/69319 If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/ One of the configured repositories failed (MongoDB Repository), 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=mongodb-org-3.4 ... 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 mongodb-org-3.4 or subscription-manager repos --disable=mongodb-org-3.4 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=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/7/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden
這個錯誤是因為 SELinux 的限制嗎?我應該如何讓 yum 安裝 mongodb?
這可能為時已晚,但在遇到同樣的問題後,我遵循了在 AWS Linux 上通過 yum 安裝 MongoDB 失敗的組合:HTTPS 錯誤 404 - 未找到(在 Stack Overflow)以及安裝 MongoDB 時對 Yum 錯誤的響應之一在 CentOS 上?(不是選定的),所以我的步驟是:
sudo rm -rf /etc/yum.repos.d/mongod* sudo yum clean all
再次創建 repo 文件
sudo vi /etc/yum.repos.d/mongodb-org-3.4.repo
粘貼以下內容(注意,對於我的系統,我將 ‘$releasever’ 替換為 7):
[mongodb-org-3.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/7/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