centos修改国内源

1、查看CentOS镜像版本
1.1 查看系统版本
uname -a

结果如下

Linux bogon 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

我们可以看出这个系统是7.x版本的

1.2 查看Centos版本
cat /etc/redhat-release

结果如下

CentOS Linux release 7.8.2003 (Core)

2、切换成国内镜像源
一般Centos采用国内阿里云或163的镜像,这里我们采用阿里云镜像

2.1 备份镜像
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.2 阿里云镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

2.3 添加EPEL
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2.4 去除不存在的bazel镜像
yum-config-manager --disable bazel

2.5 更新所有软件包
yum clean all        # 清理已下载安装包

yum makecache -y        # 生成更新索引

yum update -y        # 更新Centos系统软件包

如有侵权,请联系作者删除。

作者:Kylerr
链接:https://www.jianshu.com/p/8a939e73dcb5
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

posted @ 2024-10-12 14:57  文武双全·墨海纵横  阅读(835)  评论(0)    收藏  举报