最近需要用到Linux系统进行开发,有些包在国内安装不了,需要换源才可以。简单记录一下换源步骤:
- 备份系统自带yum源配置文件,该文件位于/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载国内yum源配置文件到/etc/yum.repos.d/,以阿里源为例
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 清理yum缓存
yum clean all
- 生成新的缓存
yum makecache
- 更新yum源检查是否生效
yum update