您的位置:首页 > 运维架构 > Linux

修改centos源为阿里云源

2017-12-15 11:27 148 查看
1.备份源文件

sudo  mkdir /opt/centos-yum.bak
sudo  mv /etc/yum.repos.d/* /opt/centos-yum.bak/


2.查看centos 版本号

cat /etc/redhat-release


3.在阿里云镜像库找到符合自己centos版本的镜像源(以下操作都是在sudo 下进行的)

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo[/code] 
4.

yum clean all
yum makecache
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: