yum list
报错如下:
[root@test1 yum]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* elrepo: mirrors.neusoft.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
https://packagecloud.io/akopytov/sysbench/el/7/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 302 - Found
正在尝试其它镜像。
One of the configured repositories failed (akopytov_sysbench),
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=akopytov_sysbench ...
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 akopytov_sysbench
or
subscription-manager repos --disable=akopytov_sysbench
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=akopytov_sysbench.skip_if_unavailable=true
failure: repodata/repomd.xml from akopytov_sysbench: [Errno 256] No more mirrors to try.
https://packagecloud.io/akopytov/sysbench/el/7/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 302 - Found
解决方案:
分析:这个主要是yum源存在问题
1、系统本身所安装的yum依赖包
[root@test1 yum]# rpm -qa|grep yum
yum-3.4.3-163.el7.centos.noarch
yum-plugin-fastestmirror-1.1.31-52.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
[root@test1 yum]#
2、卸载这些软件包
rpm -e yum-3.4.3-163.el7.centos.noarch --nodeps
rpm -e yum-plugin-fastestmirror-1.1.31-52.el7.noarch --nodeps
rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
3、根据当前服务器的相关参数,登录centos镜像网站找到需要的yum包
查看当前使用系统
[root@test1 yum]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
[root@test1 yum]#
查看系统详情
[root@test1 yum]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aaf05615b6c91d3cbb076af81aeff531c5d7dfd9, stripped
[root@test1 yum]#
下载yum依赖包
7.7.1908
为系统版本,x86_64
为系统位数
wget http://vault.centos.org/7.7.1908/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
wget http://vault.centos.org/7.7.1908/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.7.1908/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
4、安装下载的依赖
rpm -ivh yum-*
5、备份本机的yum源以防误操作/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
6、选择对应版本的 /etc/yum.repos.d/CentOS-Base.repo文件, 放入/etc/yum.repos.d/
7、运行命令生成缓存
yum clean all && yum makecache
(完)