我想将 docker 安装到离线 Centos 7 服务器中,但缺少依赖项。
我已经在本地虚拟机(带有内核 3.10 的 Centos 7)中执行了以下指令来打包 docker 安装依赖项:
yumdownloader --resolve docker
tar cvzf ~/docker.tar.gz *
然后我运行以下命令将 docker 安装到我的目标服务器 centos 7 内核 3.10 中:
tar xvf docker.tar.gz -C ~/docker
rpm -ivh --replacefiles --replacepkgs *.rpm
但我很困惑如何解决下一个版本问题:
error: Failed dependencies:
audit-libs(x86-64) = 2.8.5-4.el7 is needed by audit-libs-python-2.8.5-4.el7.x86_64
policycoreutils >= 2.5-11 is needed by container-selinux-2:2.119.2-1.911c772.el7_8.noarch
selinux-policy >= 3.13.1-216.el7 is needed by container-selinux-2:2.119.2-1.911c772.el7_8.noarch
selinux-policy-base >= 3.13.1-216.el7 is needed by container-selinux-2:2.119.2-1.911c772.el7_8.noarch
selinux-policy-targeted >= 3.13.1-216.el7 is needed by container-selinux-2:2.119.2-1.911c772.el7_8.noarch
libdevmapper.so.1.02(DM_1_02_97)(64bit) is needed by docker-2:1.13.1-203.git0be3e21.el7.centos.x86_64
libsystemd.so.0()(64bit) is needed by docker-2:1.13.1-203.git0be3e21.el7.centos.x86_64
libsystemd.so.0(LIBSYSTEMD_209)(64bit) is needed by docker-2:1.13.1-203.git0be3e21.el7.centos.x86_64
device-mapper-libs >= 7:1.02.97 is needed by docker-common-2:1.13.1-203.git0be3e21.el7.centos.x86_64
libsemanage = 2.5-14.el7 is needed by libsemanage-python-2.5-14.el7.x86_64
libsemanage.so.1(LIBSEMANAGE_1.1)(64bit) is needed by libsemanage-python-2.5-14.el7.x86_64
libsepol.so.1(LIBSEPOL_1.0)(64bit) is needed by policycoreutils-python-2.5-34.el7.x86_64
policycoreutils = 2.5-34.el7 is needed by policycoreutils-python-2.5-34.el7.x86_64
libselinux >= 2.5-14.1 is needed by setools-libs-3.3.8-4.el7.x86_64
libsepol >= 2.5-10 is needed by setools-libs-3.3.8-4.el7.x86_64
答案1
这是一个复杂的问题。离线安装依赖项很复杂:你在线和离线服务器上安装的软件包不一样,因此依赖项不匹配。
我已经记录了这里一个允许您下载离线服务器所需依赖项的过程,但它相当棘手。它记录了 zypper,但您可以将其转换为 yum/dnf。唯一的问题是它dnf
只能以 root 身份运行(我上次测试时):sudo dnf install --downloadonly -c <dnf.conf> --downloaddir=<output_dir> --setopt=reposdir=<repos_dir> --installroot=<tmp_dir>