在CentOS 7中更换为阿里云yum源的步骤如下:
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum clean all
sudo yum makecache
sudo yum update
如果需要额外的软件包:
sudo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sudo yum install -y wget
--no-check-certificate
参数yum repolist
应该能看到aliyun的镜像地址出现在输出结果中。
如果需要恢复原来的源:
sudo mv /etc/yum.repos.d/CentOS-Base.repo.backup /etc/yum.repos.d/CentOS-Base.repo
sudo yum clean all
sudo yum makecache