1、查看当前系统版本
#lsb_release -a
若出现command not found 的错误,则
# yum -y install redhat-lsb
2、设置网卡eth0,centos7中/etc/sysconfig/network-scripts中没有ifcfg-eth0,只有ifcfg-ens33
#cd /etc/sysconfig/network-scripts
#mv ifcfg-ens33 ifcfg-eth0
#vi ifcfg-eth0,修改NAME=eth0
#vi /etc/default/grub,在GRUB_CMDLINE_LINUX变量中增加net.ifnames=0 biosdevname=0
#grub2-mkconfig -o /boot/grub2/grub.cfg
#reboot
3、备份原yum数据源
#mv /etc/yum.repos.d/CentOS-base.repo /etc/yum.repos.d/CentOS-base.repo.back
4、下载对应版本repo,放入/etc/yum.repos.d
http://mirrors.163.com/.help/CentOS7-Base-163.repo
http://mirrors.163.com/.help/CentOS6-Base-163.repo
http://mirrors.163.com/.help/CentOS5-Base-163.repo
5、使yum源生效
#yum clean all
#yum makecache