yum 更换阿里源

1. 备份旧的配置文件

1 cd /etc/yum.repos.d/ # 进入文件夹
2 mv CentOS-Base.repo CentOS-Base.repo_back # 备份原始配置文件

2. 下载阿里源的文件

1 wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2 # 若没有 wget 可使用 curl
3 curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. 安装 epel repo 源

1 wget -O epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2 # 若没有 wget 可使用 curl
3 curl -o epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

4. 清理缓存

1 yum clean all

5. 重新生成缓存

1 yum makecache

6. 更新

1 yum -y update
posted @ 2022-09-27 18:39  叶森白  阅读(379)  评论(0编辑  收藏  举报