centos6更新yum源为阿里云

本次修改的是CentOS 6.10 系统。centos

先备份原来的源配置文件 缓存

/etc/yum.repos.d/CentOS-Base.repo微信

上面是原来的文件。作个备份先。能够直接在文件管理工具上重命名,也能够直接命令行下用命令操做。工具

命令以下:阿里云

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupcentos7

 

而后下载阿里云的源配置文件命令行

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repoget

若是提示没有 wget ,那么就安装一下。 yum install wget,固然,执行这个命令以前,先要把以前重命名的源配置文件还原回来。再执行安装命令安装wget配置

而后运行yum makecache生成缓存
yum makecachedate

 

下面是从网上找来的其余配置文章内容。供其余版本的参考。

[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


[2] 进入yum源配置文件所在文件夹

cd /etc/yum.repos.d/


[3] 下载163或者阿里云的yum源配置文件,放入/etc/yum.repos.d/(操做前请作好相应备份)

163:
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

centos5:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo


centos6:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


centos7:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


[4] 运行yum makecache生成缓存
yum makecache


[5] 更新系统

yum -y update
 

 

 

本人微信:   本人QQ:

相关文章
相关标签/搜索