安装wget
yum -y install wget
备份默认源文件
进入yum.repos.d文件夹
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.backup
下载yum源
阿里源
wget http://mirrors.aliyun.com/repo/Centos-7.repo
清理旧包
yum clean all
把下载下来阿里repo文件设置成为默认源
mv Centos-7.repo CentOS-Base.repo
回到根目录
cd
安装epel源
yum install epel-release.noarch
下载阿里开源镜像的epel源文件
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
生成源缓存并更新yum源
yum makecache
yum update
扩展
网易yum源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
错误反馈
yum 进程被占用
rm -f /var/run/yum.pid
一直报错,使用的是google的镜像
cd /etc/yum.repos.d/
rm -f google-chrome.repo