如何为Centos7换源

2025-10-19 08:09:37

1、首先

备份文件

sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

如图

如何为Centos7换源

2、然后

使用

sudo vi /etc/yum.repos.d/CentOS-Base.repo

打开配置文件

如图

如何为Centos7换源

3、拷贝

https://mirrors.tuna.tsinghua.edu.cn/help/centos/

里的内容

如图内容

输入进去

如何为Centos7换源

4、然后输入:wq

写入新的内容

如何为Centos7换源

5、此时,

配置文件已经修改了

然后输入

sudo yum makecache

更新源

如何为Centos7换源

6、然后

就能看见

如下信息,就表示更新成功了!

如何为Centos7换源

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢