Ale*_*lig 9 yum centos repository
我已经在我的服务器上安装了 CentOs 7 并且由于一些未知的原因(至少是我)意识到,默认的 yum 存储库不起作用。
例如我试过yum install vim但得到
加载的插件:fastestmirror
配置的存储库之一失败(未知),并且 yum 没有足够的缓存数据来继续。在这一点上,yum 唯一可以做的安全事情就是失败。有几种方法可以“修复”这个问题:
Run Code Online (Sandbox Code Playgroud)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=<repoid> ... 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 <repoid> or subscription-manager repos --disable=<repoid> 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=<repoid>.skip_if_unavailable=true找不到用于 repo 的有效 baseurl:addons/7
我通过网络搜索以了解问题所在,但找不到任何东西。所以我决定我应该添加默认的存储库,这些存储库应该是我自己默认添加的。
但我不知道怎么做。
那么有没有办法做到这一点并使百胜工作?
我下载 CentOs 7 的链接:
http://mirror.teklinks.com/centos/7.3.1611/isos/x86_64/CentOS-7-x86_64-Everything-1611.iso
编辑 2
考虑到我的 CentOS 版本,通过清理所有存储库并从这里添加新存储库,错误消失了:
# yum clean all
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# rpm -Uvh http://dl.atrpms.net/all/atrpms-repo-7-7.el7.x86_64.rpm
# rpm -Uvh http://repo.webtatic.com/yum/el7/webtatic-release.rpm
Run Code Online (Sandbox Code Playgroud)
但是现在通过运行yum install vim我得到:
加载的插件:fastestmirror
从缓存的主机文件加载镜像速度
* epel: ftp.riken.jp
* remi -safe: rpms.remirepo.net
* webtatic: uk.repo.webtatic.com
没有可用的软件包 vim。
错误:无事可做
您忽略了添加默认的 CentOS 7.x 存储库,这可能是您遇到问题的原因。顺便说一句,您可以通过获取另一个 RPM 来解决此问题:
$ rpm -ivh http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-6.1810.2.el7.centos.x86_64.rpm
Run Code Online (Sandbox Code Playgroud)
注意:您可以使用rpm查询来找出要获取的 RPM,以查看 RPM 提供给定文件的内容。在我们的例子中,这些文件:
$ rpm -qf /etc/yum.repos.d/CentOS-* | sort -u
centos-release-7-6.1810.2.el7.centos.x86_64
Run Code Online (Sandbox Code Playgroud)
一旦我们重新安装了这个 RPM,它就会刷新我们在 .repo 下的基础存储库的 .repo 文件/etc/yum.d。如果我们不知道在哪里下载它的 URL,我们可以再次向 RPM 查询。
首先记下RPM的名称:
$ rpm -qi centos-release-7-6.1810.2.el7.centos.x86_64 | grep Name
Name : centos-release
Run Code Online (Sandbox Code Playgroud)
然后在pkgs.org 上搜索这个短名称,这将引导您到我上面在rpm -ivh ...命令中显示的 URL 。
注意:相同的步骤可以应用于 CentOS 7.3 或您当前使用的任何版本的 CentOS。
配置存储库源的文件位于
/etc/yum.conf
/etc/yum.repos.d/*
Run Code Online (Sandbox Code Playgroud)
验证这些文件是否具有正确的存储库链接。特别是其中的一个/etc/yum/repos.d
您可能需要 sudo 访问权限才能编辑它们。它们相当于/etc/apt/sources.list基于 Debian 的系统
| 归档时间: |
|
| 查看次数: |
119951 次 |
| 最近记录: |