搭建docker的时候,手贱将yum卸载的干干净净,然后自己离线安装,花费了一点时间,很尴尬。简单说明一下yum离线安装的步骤
1、命令:rpm -qa|grep yum 查看已存在的安装包,如果存在先卸载的干干净净
2、卸载干净之后,需要离线安装一些文件
wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
如果以上路径失效,请到http://vault.centos.org/7.4.1708/os/x86_64/Packages/下载对应的文件
3、下载完成之后安装
4、接下来继续这些操作
cd /etc/yum.repos.d
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache
5、测试是否安装成功,输入命令yum