以下命令請在root下執行 #刪除原有的yum rpm -qa|grep yum|xargs rpm -e --nodeps #install centos yum #wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm #wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm #wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm #wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm #wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm ###原來照上面的思路做 一直有問題,應該是沒有安裝python-iniparse包所致 隨時間的變化 下面的鏈接可能會失效 需要到網站上確認小版本的變化 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm #安裝這些依賴 rpm -ivh yum-* --nodeps ###更新CentosBase.repo cat <<EOF >/etc/yum.repos.d/CentOS-Base.repo [base] name=CentOS-$releasever - Base baseurl=https://mirrors.aliyun.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 [updates] name=CentOS-$releasever - Updates baseurl=https://mirrors.aliyun.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-$releasever - Extras baseurl=https://mirrors.aliyun.com/centos/7/extras//$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 [centosplus] name=CentOS-$releasever - Plus baseurl=https://mirrors.aliyun.com/centos/7/centosplus//$basearch/ gpgcheck=1 enabled=0 EOF #UPDATE YUM yum clean all yum makecache #######DOWNLOAD ALL FILES yum install docker-ce --downloadonly --downloaddir=/root/docker #####以下是根據redhat7.4默認新裝的情況做的處理,正確的做法 應該根據當前機器是否安裝這個包,如果安裝則更新,如果沒有則安裝的思路來做 rpm -U --nodeps audit-2.8.1-3.el7_5.1.x86_64.rpm rpm -U --nodeps audit-libs-2.8.1-3.el7_5.1.x86_64.rpm rpm -ivh --nodeps audit-libs-python-2.8.1-3.el7_5.1.x86_64.rpm rpm -ivh --nodeps checkpolicy-2.5-6.el7.x86_64.rpm rpm -ivh --nodeps containerd.io-1.2.0-3.el7.x86_64.rpm rpm -ivh --nodeps python-IPy-0.75-6.el7.noarch.rpm rpm -U --nodeps libselinux-2.5-12.el7.x86_64.rpm rpm -U --nodeps libselinux-python-2.5-12.el7.x86_64.rpm rpm -U --nodeps libselinux-utils-2.5-12.el7.x86_64.rpm rpm -U --nodeps libsemanage-2.5-11.el7.x86_64.rpm rpm -ivh --nodeps libsemanage-python-2.5-11.el7.x86_64.rpm rpm -U --nodeps libsepol-2.5-8.1.el7.x86_64.rpm rpm -U --nodeps policycoreutils-2.5-22.el7.x86_64.rpm rpm -ivh --nodeps policycoreutils-python-2.5-22.el7.x86_64.rpm rpm -U --nodeps selinux-policy-3.13.1-192.el7_5.6.noarch.rpm rpm -U --nodeps selinux-policy-targeted-3.13.1-192.el7_5.6.noarch.rpm rpm -ivh --nodeps container-selinux-2.68-1.el7.noarch.rpm rpm -ivh --nodeps setools-libs-3.3.8-2.el7.x86_64.rpm rpm -ivh --nodeps docker-ce-18.09.0-3.el7.x86_64.rpm rpm -ivh --nodeps docker-ce-cli-18.09.0-3.el7.x86_64.rpm
redhat 需要注冊后才能使用yum,所以有以上的操作。
