美文网首页
redhat 7.2安装docker

redhat 7.2安装docker

作者: 你的努力时光不会辜负 | 来源:发表于2021-06-15 17:24 被阅读0次

    1、root账户登录,查看内核版本

    uname -a   
    

    (检查内核版本,返回的值大于3.10即可)

    把yum包更新到最新

    yum update
    

    安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

    yum install -y yum-utils device-mapper-persistent-data lvm2/
    

    2、设置yum源

    
    yum-config-manager --add-repo [https://download.docker.com/linux/centos/docker-ce.repo](https://download.docker.com/linux/centos/docker-ce.repo)
    

    3、如果yum不可用,用阿里yum

    参考:redHat 7.2 安装yum 切阿里源

    cd /etc/yum.repos.d
    
    wget http://mirrors.aliyun.com/repo/Centos-7.repo
    

    下载完成

    修改刚下载的文件 将所有$releasever替换为7

    # vim /etc/yum.repos.d/CentOS-Base.repo 
    
    # :%s/$releasever/7/g
    

    修改配置文件CnetOS-Base.repo,通过vim编辑器打开CnetOS-Base.repo , 替换

    releaserver/6/g ,wq保存退出。

    注:g标示全局替换,将$releaserver替换为6,这里替换的是centos版本,安装cdh时候回到指定目录下载相关文件,最好是在浏览器打开baseurl路径,查看指定路径下的数据包是否存在,不存在请使用其他版本。

    运行以下命令即可

    
    yum clean all 
    
    yum makecache
    
    yum update
    

    4、阿里yum的地址如下

    # CentOS-Base.repo
    
    #
    
    # The mirror system uses the connecting IP address of the client and the
    
    # update status of each mirror to pick mirrors that are updated to and
    
    # geographically close to the client.  You should use this for CentOS updates
    
    # unless you are manually picking other mirrors.
    
    #
    
    # If the mirrorlist= does not work for you, as a fall back you can try the
    
    # remarked out baseurl= line instead.
    
    #
    
    #
    
    [base]
    
    name=CentOS-7 - Base - mirrors.aliyun.com
    
    failovermethod=priority
    
    baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
    
            http://mirrors.aliyuncs.com/centos/7/os/$basearch/
    
            http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
    
    gpgcheck=1
    
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
    
    #released updates
    
    [updates]
    
    name=CentOS-7 - Updates - mirrors.aliyun.com
    
    failovermethod=priority
    
    baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
    
            http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
    
            http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
    
    gpgcheck=1
    
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
    
    #additional packages that may be useful
    
    [extras]
    
    name=CentOS-7 - Extras - mirrors.aliyun.com
    
    failovermethod=priority
    
    baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
    
            http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
    
            http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
    
    gpgcheck=1
    
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
    
    #additional packages that extend functionality of existing packages
    
    [centosplus]
    
    name=CentOS-7 - Plus - mirrors.aliyun.com
    
    failovermethod=priority
    
    baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
    
            http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
    
            http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
    
    gpgcheck=1
    
    enabled=0
    
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
    
    #contrib - packages by Centos Users
    
    [contrib]
    
    name=CentOS-7 - Contrib - mirrors.aliyun.com
    
    failovermethod=priority
    
    baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
    
            http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
    
            http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
    
    gpgcheck=1
    
    enabled=0
    
    gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
    

    5、启动

    启动Docker

    systemctl start docker
    

    设置开机启动

    systemctl enable docker
    

    验证安装是否成功(有client和service两部分表示docker安装启动都成功了)

    docker version
    

    相关文章

      网友评论

          本文标题:redhat 7.2安装docker

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