某些情况下因为某些原因服务器无法访问互联网。此时就需要进行离线安装,首先我们需要在可以上网的服务器上将需要安装软件的rpm离线包下载下来,然后去不能上网的服务器上安装。以下是几种下载的方法.
查看依赖包
代码语言:javascript复制> yum deplist nginx
package: nginx.x86_64 1:1.20.1-1.el7.ngx
dependency: /bin/sh
provider: bash.x86_64 4.2.46-34.el7
dependency: libc.so.6(GLIBC_2.17)(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libcrypt.so.1()(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libcrypt.so.1(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libcrypto.so.10()(64bit)
provider: openssl-libs.x86_64 1:1.0.2k-21.el7_9
dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit)
provider: openssl-libs.x86_64 1:1.0.2k-21.el7_9
dependency: libcrypto.so.10(libcrypto.so.10)(64bit)
provider: openssl-libs.x86_64 1:1.0.2k-21.el7_9
dependency: libdl.so.2()(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libdl.so.2(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libpcre.so.1()(64bit)
provider: pcre.x86_64 8.32-17.el7
dependency: libpthread.so.0()(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libpthread.so.0(GLIBC_2.3.2)(64bit)
provider: glibc.x86_64 2.17-324.el7_9
dependency: libssl.so.10()(64bit)
provider: openssl-libs.x86_64 1:1.0.2k-21.el7_9
dependency: libssl.so.10(libssl.so.10)(64bit)
provider: openssl-libs.x86_64 1:1.0.2k-21.el7_9
dependency: libz.so.1()(64bit)
provider: zlib.x86_64 1.2.7-19.el7_9
dependency: openssl >= 1.0.2
provider: openssl.x86_64 1:1.0.2k-21.el7_9
dependency: rtld(GNU_HASH)
provider: glibc.x86_64 2.17-324.el7_9
provider: glibc.i686 2.17-324.el7_9
dependency: shadow-utils
provider: shadow-utils.x86_64 2:4.6-5.el7
dependency: systemd
provider: systemd.x86_64 219-78.el7_9.3
方法一:使用repotrack下载nginx rpm安装所需要的所有依赖
代码语言:javascript复制> yum install yum-utils -y
//下载nginx全量依赖包
> repotrack nginx
方法二:使用yumdownloader下载
代码语言:javascript复制> yum install yum-utils -y
> yumdownloader --resolve --destdir=. nginx
- --destdir:指定 rpm 包下载目录(不指定时,默认为当前目录)
- --resolve:下载依赖的 rpm 包。
方法三:yum 的 downloadonly 插件
代码语言:javascript复制> yum install yum-download -y
> yum -y install nginx --downloadonly --downloaddir=.
与 yumdownloader 命令一样,也是仅会将主软件包和基于你现在的操作系统所缺少的依赖关系包一并下载。
离线安装 rpm
代码语言:javascript复制> rpm -Uvh --force --nodeps *.rpm