本次修改的是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: