美文网首页
docker 下载rhel7.6镜像修改yum源

docker 下载rhel7.6镜像修改yum源

作者: 我说早早早 | 来源:发表于2021-07-21 23:09 被阅读0次

    下载镜像

    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 创建目录

    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. 卸载系统自带的yum相关安装

    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. 设置yum源

    5.1 进入/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

    相关文章

      网友评论

          本文标题:docker 下载rhel7.6镜像修改yum源

          本文链接:https://www.haomeiwen.com/subject/lmvsmltx.html