美文网首页
Offline package Installation II

Offline package Installation II

作者: 海胆阶段 | 来源:发表于2019-02-27 15:10 被阅读0次

    Now, let's practice what we have learned from series I. For example, I want to create a self-contained k8s cluster installer, that means I need to install docker and kubeadm etc offline in the target machine.

    Docker

    Note: here we only download actual dependencies need for installation, not all rpms if we use --installroot option

    I want to install Docker 18.06.3 (currently kubeadm now properly recognizes Docker 18.09.0 and newer, but still treats 18.06 as the default supported version). You should perform below steps on a machine that hasn't install docker yet.

    Note: install from a package, rpms list in this link are not complete, they are in top level but can be used to upgrade version.

    Uninstall old version

    yum remove docker \
               docker-client \
               docker-client-latest \
               docker-common \
               docker-latest \
               docker-latest-logrotate \
               docker-logrotate \
               docker-engine
    

    The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. The Docker CE package is now called docker-ce.

    Set up docker repository

    Before you install Docker CE for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

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

    Use the following command to set up the stable repository.

    yum-config-manager \
        --add-repo \
        https://download.docker.com/linux/centos/docker-ce.repo
    

    List docker version

    List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:

    yum list docker-ce --showduplicates | sort -r
    
    Loaded plugins: product-id, search-disabled-repos
    docker-ce.x86_64            3:18.09.2-3.el7                     docker-ce-stable
    docker-ce.x86_64            3:18.09.1-3.el7                     docker-ce-stable
    docker-ce.x86_64            3:18.09.0-3.el7                     docker-ce-stable
    docker-ce.x86_64            18.06.3.ce-3.el7                    docker-ce-stable
    docker-ce.x86_64            18.06.2.ce-3.el7                    docker-ce-stable
    docker-ce.x86_64            18.06.1.ce-3.el7                    docker-ce-stable
    docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
    docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
    docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
    docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
    ...
    

    Download docker rpms

    Install a specific version by its fully qualified package name, which is the package name (docker-ce) plus the version string (2nd column) starting at the first colon (:), up to the first hyphen, separated by a hyphen (-). For example, docker-ce-18.06.3.ce.

    mkdir -p /root/docker-18.06.3-rpms
    yum install --downloadonly --downloaddir=/root/docker-18.06.3-rpms docker-ce-18.06.3.ce
    

    list the rpms in the target folder:

    audit-2.8.4-4.el7.x86_64.rpm               libselinux-utils-2.5-14.1.el7.x86_64.rpm
    audit-libs-2.8.4-4.el7.x86_64.rpm          libsemanage-2.5-14.el7.x86_64.rpm
    audit-libs-python-2.8.4-4.el7.x86_64.rpm   libsemanage-python-2.5-14.el7.x86_64.rpm
    checkpolicy-2.5-8.el7.x86_64.rpm           libsepol-2.5-10.el7.x86_64.rpm
    container-selinux-2.68-1.el7.noarch.rpm    libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
    docker-ce-18.06.3.ce-3.el7.x86_64.rpm      policycoreutils-2.5-29.el7_6.1.x86_64.rpm
    libcgroup-0.41-20.el7.x86_64.rpm           policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm
    libseccomp-2.3.1-3.el7.x86_64.rpm          python-IPy-0.75-6.el7.noarch.rpm
    libselinux-2.5-14.1.el7.x86_64.rpm         setools-libs-3.3.8-4.el7.x86_64.rpm
    libselinux-python-2.5-14.1.el7.x86_64.rpm
    

    Note that the required components may be changed in later version, such as 18.09.2

    mkdir -p /root/docker-18.09.2-rpms
    yum install --downloadonly --downloaddir=/root/docker-18.09.2-rpms docker-ce-18.09.2 docker-ce-cli-18.09.2 containerd.io
    
    

    Install docker rpms

    now install docker 18.06.3 offline by running:

    yum --disablerepo=* -y install /root/docker-18.06.3-rpms/*.rpm
    

    相关文章

      网友评论

          本文标题:Offline package Installation II

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