centos7误删yum源的解决办法 ( -bash: yum: command not found)
这里以安装阿里的yum源为例:
1.查看自己的centos版本
cat /etc/redhat-release
2.进入阿里云源站地址:http://mirrors.aliyun.com/centos,找到自己虚拟机的版本
3.下载相应的yum包
wget https://mirrors.aliyun.com/centos/7.7.1908/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget https://mirrors.aliyun.com/centos/7.7.1908/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm wget https://mirrors.aliyun.com/centos/7.7.1908/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
4.按顺序执行下面命令
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
5.测试