下載鏡像
docker pull registry.access.redhat.com/rhel7:7.6
修改yum源
1. 安裝wget
1.1 wget下載地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm
2.2 命令:rpm -ivh?wget-1.14-18.el7_6.1.x86_64.rpm
2. 下載yum必須的rpm文件
2.1 創(chuàng)建目錄
cd /usr/local
mkdir soft
cd soft
#### 2.2 下載rpm文件
wget https://vault.centos.org/7.3.1611/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://vault.centos.org/7.3.1611/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget https://vault.centos.org/7.3.1611/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
wget https://vault.centos.org/7.3.1611/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.3.1611/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
3.?卸載系統(tǒng)自帶的yum相關(guān)安裝
3.1 查看原來是否安裝yum: rpm -qa | grep yum
3.2?直接卸載自帶的yum: rpm -qa|grep yum|xargs rpm -e --nodeps
3.3 查看是否卸載干凈: rpm -qa |grep yum
4.?安裝centos源yum
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
rpm -ivh yum-3.4.3-150.el7.centos.noarch.rpm --force --nodeps
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm --force --nodeps
5. 設(shè)置yum源
5.1 進(jìn)入/etc/yum.repos.d/目錄
5.2 刪除目錄下的所有文件
5.3 下載yum源
wget http://mirrors.aliyun.com/repo/Centos-7.repo
5.4 打開下載的文件并編輯,將$release 全部替換成7
vi Centos-7.repo?
:%s/$release/7/g
5.5 清楚緩存
yum clean all
5.6 建立緩存
yum makecache