赞
踩
mkdir /etc/yum.repos.d.bak
mv /etc/yum.repos.d/* /etc/yum.repos.d.bak/
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
# 删除"mirrors.cloud.aliyuncs.com" 及 "mirrors.aliyuncs.com" 字符串所在的行
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
# 替换 "releasever/" 为 "releasever-stream/"
sed -i 's/releasever\//releasever-stream\//g' /etc/yum.repos.d/CentOS-Base.repo
dnf -y install epel-release
替换为阿里源:
cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
cp /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
yum clean all
yum makecache
yum -y update
Q:安装包时报错:.rpm: signature 头部数据:不当,字节(61896)的号码超出范围
A:这是因为 yum 版本不匹配问题,需要首先更新 yum .执行下面操作:
yum upgrade rpm
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。