CentOS7停更后,如何配置国内Yum源、镜像源
yum介绍
Yum(Yellowdog Updater Modified)是一个在CentOS和Red Hat Enterprise Linux(RHEL)等基于RPM的系统中使用的包管理器。默认情况下,CentOS会使用官方的Yum源进行软件包的安装和更新。然而,由于网络环境的不同,国内用户可能会遇到访问官方源较慢或不稳定的问题。为了解决这个问题,我们可以配置国内的Yum源来加快软件包的下载速度。
步骤
1. 备份原有的yum源文件
使用说明
首先备份/etc/yum.repos.d/CentOS-Base.repo
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
2. 下载国内Yum源文件
阿里云Yum源
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
清华大学TUNA镜像站Yum源
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/help/centos-7-fast.html
中科大镜像源
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.ustc.edu.cn/centos/7/os/x86_64/
3. 清除缓存并更新Yum源
sudo yum clean all
sudo yum makecache
4. 使用国内Yum源
现在你可以使用国内的Yum源来安装和更新软件包了。例如:
sudo yum install wget
sudo yum install zip
sudo yum install unzip