解决在更换yum源时无法使用wget指令的问题

测试网络

先ping一下网络,看看能不能ping通,先排除是网络的问题

ping www.baidu.com

有消息回传说明网络有连接,没有的话就要去把虚拟机的网络连接好(Ctrl+C关闭)

使用curl指令解决

接下来写centos更换源 一般yum用不了,下载不来wget 那么我们用curl指令

  1. 备份系统自带yum源配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  1. 通过curl下载yum源,需要服务器可以联网
curl -o /etc/yum.repos.d/CentOS-Base.repo [http://mirrors.aliyun.com/repo/Centos-7.repo](http://mirrors.aliyun.com/repo/Centos-7.repo)

如果你的centos版本是5,6,8,9那就把7换成对应的数字

  1. 运行yum makecache生成缓存
yum makecache
  1. 更新yum源
yum -y update