[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源配置文件所在文件夹

[root@localhost yum.repos.d]# cd /etc/yum.repos.d/

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

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo

[4] 运行yum makecache生成缓存

[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/8): extras/7/x86_64/prestodelta | 77 kB 00:00
(2/8): extras/7/x86_64/other_db | 707 kB 00:05
(3/8): extras/7/x86_64/filelists_db | 466 kB 00:06
(4/8): updates/7/x86_64/prestodelta | 763 kB 00:02
(5/8): base/7/x86_64/other_db | 2.3 MB 00:11
(6/8): updates/7/x86_64/filelists_db | 4.7 MB 00:12
(7/8): base/7/x86_64/filelists_db | 6.2 MB 00:22
(8/8): updates/7/x86_64/other_db | 68 MB 02:13
Loading mirror speeds from cached hostfile
Metadata Cache Created

[5] 更新系统

[root@localhost yum.repos.d]# yum -y update

[6] 安装vim编辑器

[root@localhost ~]# yum -y install vim*