零 配置环境
centos
一 遇到的问题
问题一: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
解决方法:
cd /etc/yum.repos.d vi CentOS-Base.repo :%s/$releasever/7/g #将文件中$releasever全部改成7 yum clean all && yum makecache # 清除和缓存
其中$releasever 是获取你centos的版本号的,例如我的centos的版本号为6.7,获取到的为6,但是已经找不到了,所以直接全局改成7即可。
问题二:提示No more mirrors to try
Error Downloading Packages: binutils-2.27-44.base.el7.x86_64: failure: Packages/binutils-2.27-44.base.el7.x86_64.rpm from base: [Errno 256] No more mirrors to try.
解决方法:重新下载
问题三:Public key for glibc-common-2.17-317.el7.x86_64.rpm is not installed
解决方法:
1 导入GPG keys:
#rpm -- import /etc/pki/rpm-gpg/PRM-GPG-KEY -*
2 修改yum源文件,跳过gpg check(不推荐)
把repo文件设置为gpgcheck =0
使用yum install时加上参数 -no gpgcheck
3 下载最新签名(推荐)
cd /etc/pki/rpm-gpg
wget http://mirrors.163.com/centos/RPM-KEY-CentOS-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
问题四:ERROR with rpm_check_debug vs depsolve
ERROR with rpm_check_debug vs depsolve:
/sbin/new-kernel-pkg is needed by (installed) kernel-2.6.32-431.el6.x86_64
/sbin/new-kernel-pkg is needed by (installed) kernel-2.6.32-431.el6.x86_64
You could try running: rpm -Va --nofiles --nodigest
Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx-2020-12-24-08-20xUyYyL.yumtx
解决方法:待补充
二 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
Centos-6
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
Centos-7
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
Centos-8
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
三 yum源的常用操作命令
1 清理缓存:yum clean all
2 生成新缓存:yum makecache
3 执行yum更新:yum update