开机找到相应内核,然后‘e’,下面找到ro 字样     更改为 rw init=/sysroot/bin/sh     Ctrl+x 进入到单用户模式     chroot /sysroot     passwd root     输入2次新密码     touch /.autorelabel 重启服务器或虚拟机 centos7更改yum源为aliyun    1. 确认电脑或虚拟机可以连接网络        ping www.baidu.com        如果不通请检查网络设置,网关及DNS(/etc/resolv.conf)            2. yum -y install wget       wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo                            3. yum makecache