如何为Centos7换源

时间:2026-02-14 08:38:12

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换源

© 2026 海能知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com