当前位置:   article > 正文

Centos 8 替换镜像源_centos8换源

centos8换源

1. 替换

1.1 备份

mkdir /etc/yum.repos.d.bak
mv /etc/yum.repos.d/* /etc/yum.repos.d.bak/
  • 1
  • 2

1.2 下载

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
  • 1

1.3 更新

# 删除"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
  • 1
  • 2
  • 3
  • 4
  • 5

1.4 安装 elep

dnf -y install epel-release
  • 1

替换为阿里源

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

遇到问题

Q:安装包时报错:.rpm: signature 头部数据:不当,字节(61896)的号码超出范围

A:这是因为 yum 版本不匹配问题,需要首先更新 yum .执行下面操作:

yum upgrade rpm
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/179269
推荐阅读
相关标签
  

闽ICP备14008679号