生产环境在内网,无法通过 yum 下载安装 nginx 程序,需要通过外网下载 nginx 及所有依赖程序,再拷贝至内网进行安装。
1. 搜索 nginx
搜索 nginx 主要是为了查看 nginx 版本号,可以看到日志中显示版本号为 1.20.1
yum info nginx
[root@master1 ~]# yum info nginx
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.bupt.edu.cn
* epel: hkg.mirror.rackspace.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.cn99.com
可安装的软件包
名称 :nginx
架构 :x86_64
时期 :1
版本 :1.20.1
发布 :9.el7
大小 :587 k
源 :epel/x86_64
简介 : A high performance web server and reverse proxy server
网址 :https://nginx.org
协议 : BSD
描述 : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
: IMAP protocols, with a strong focus on high concurrency, performance and low
: memory usage.
2. 查看 nginx 依赖
通过该命令可以查看 nginx 程序详细的依赖程序列表
yum deplist nginx
[root@master1 ~]# yum deplist nginx
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: ftp.yz.yamagata-u.ac.jp
* extras: mirrors.cn99.com
* updates: mirrors.aliyun.com
软件包:nginx.x86_64 1:1.20.1-9.el7
依赖:/bin/sh
provider: bash.x86_64 4.2.46-35.el7_9
依赖:libc.so.6(GLIBC_2.17)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libcrypt.so.1()(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libcrypt.so.1(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libcrypto.so.1.1()(64bit)
provider: openssl11-libs.x86_64 1:1.1.1k-3.el7
依赖:libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
provider: openssl11-libs.x86_64 1:1.1.1k-3.el7
依赖:libdl.so.2()(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libdl.so.2(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libpcre.so.1()(64bit)
provider: pcre.x86_64 8.32-17.el7
依赖:libprofiler.so.0()(64bit)
provider: gperftools-libs.x86_64 2.6.1-1.el7
依赖:libpthread.so.0()(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libpthread.so.0(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libpthread.so.0(GLIBC_2.3.2)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
依赖:libssl.so.1.1()(64bit)
provider: openssl11-libs.x86_64 1:1.1.1k-3.el7
依赖:libssl.so.1.1(OPENSSL_1_1_0)(64bit)
provider: openssl11-libs.x86_64 1:1.1.1k-3.el7
依赖:libssl.so.1.1(OPENSSL_1_1_1)(64bit)
provider: openssl11-libs.x86_64 1:1.1.1k-3.el7
依赖:libz.so.1()(64bit)
provider: zlib.x86_64 1.2.7-20.el7_9
依赖:nginx-filesystem
provider: nginx-filesystem.noarch 1:1.20.1-9.el7
依赖:nginx-filesystem = 1:1.20.1-9.el7
provider: nginx-filesystem.noarch 1:1.20.1-9.el7
依赖:openssl
provider: openssl.x86_64 1:1.0.2k-25.el7_9
依赖:pcre
provider: pcre.x86_64 8.32-17.el7
provider: pcre.i686 8.32-17.el7
依赖:redhat-indexhtml
provider: centos-indexhtml.noarch 7-9.el7.centos
依赖:rtld(GNU_HASH)
provider: glibc.x86_64 2.17-326.el7_9
provider: glibc.i686 2.17-326.el7_9
依赖:system-logos
provider: centos-logos.noarch 70.0.6-3.el7.centos
依赖:systemd
provider: systemd.x86_64 219-78.el7_9.5
3. 下载 nginx rpm 安装包
通过该命令单独下载 nginx 程序包,下载完成后在指定目录下出现 nginx.x86_64.1.1.20.1-9.el7
yum install -y --downloadonly --downloaddir=/tmp/ nginx
[root@master1 ~]# yum install -y --downloadonly --downloaddir=/tmp/ nginx
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: ftp.iij.ad.jp
* extras: mirrors.cn99.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 nginx.x86_64.1.1.20.1-9.el7 将被 安装
--> 正在处理依赖关系 nginx-filesystem = 1:1.20.1-9.el7,它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libcrypto.so.1.1(OPENSSL_1_1_0)(64bit),它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libssl.so.1.1(OPENSSL_1_1_0)(64bit),它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libssl.so.1.1(OPENSSL_1_1_1)(64bit),它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 nginx-filesystem,它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 redhat-indexhtml,它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libcrypto.so.1.1()(64bit),它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libprofiler.so.0()(64bit),它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libssl.so.1.1()(64bit),它被软件包 1:nginx-1.20.1-9.el7.x86_64 需要
--> 正在检查事务
---> 软件包 centos-indexhtml.noarch.0.7-9.el7.centos 将被 安装
---> 软件包 gperftools-libs.x86_64.0.2.6.1-1.el7 将被 安装
---> 软件包 nginx-filesystem.noarch.1.1.20.1-9.el7 将被 安装
---> 软件包 openssl11-libs.x86_64.1.1.1.1k-3.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
======================================================================================================================================================================================================
Package 架构 版本 源 大小
======================================================================================================================================================================================================
正在安装:
nginx x86_64 1:1.20.1-9.el7 epel 587 k
为依赖而安装:
centos-indexhtml noarch 7-9.el7.centos base 92 k
gperftools-libs x86_64 2.6.1-1.el7 base 272 k
nginx-filesystem noarch 1:1.20.1-9.el7 epel 24 k
openssl11-libs x86_64 1:1.1.1k-3.el7 epel 1.5 M
事务概要
======================================================================================================================================================================================================
安装 1 软件包 (+4 依赖软件包)
总下载量:2.4 M
安装大小:6.7 M
Background downloading packages, then exiting:
(1/5): centos-indexhtml-7-9.el7.centos.noarch.rpm | 92 kB 00:00:00
(2/5): gperftools-libs-2.6.1-1.el7.x86_64.rpm | 272 kB 00:00:00
warning: /tmp/nginx-1.20.1-9.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY==========================- ] 176 kB/s | 1.2 MB 00:00:07 ETA
nginx-1.20.1-9.el7.x86_64.rpm 的公钥尚未安装
(3/5): nginx-1.20.1-9.el7.x86_64.rpm | 587 kB 00:00:03
(4/5): openssl11-libs-1.1.1k-3.el7.x86_64.rpm | 1.5 MB 00:00:22
(5/5): nginx-filesystem-1.20.1-9.el7.noarch.rpm | 24 kB 00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 81 kB/s | 2.4 MB 00:00:30
exiting because "Download Only" specified
4. 下载 nginx rpm 依赖
试过各种方法,包括 yumdownloader 和 downloadonly ,结果下载的依赖都不全,推荐使用 repotrack
# 下载 yum 工具包
yum -y install yum-utils
# 使用 repotrack 工具下载依赖
repotrack -p /home/nginx-pkgs/ nginx
[root@master1 ~]# repotrack nginx
Downloading acl-2.2.51-15.el7.x86_64.rpm
Downloading audit-libs-2.8.5-4.el7.x86_64.rpm
Downloading audit-libs-2.8.5-4.el7.i686.rpm
Downloading basesystem-10.0-7.el7.centos.noarch.rpm
Downloading bash-4.2.46-35.el7_9.x86_64.rpm
Downloading binutils-2.27-44.base.el7_9.1.x86_64.rpm
Downloading bzip2-libs-1.0.6-13.el7.x86_64.rpm
Downloading bzip2-libs-1.0.6-13.el7.i686.rpm
Downloading ca-certificates-2021.2.50-72.el7_9.noarch.rpm
Downloading centos-logos-70.0.6-3.el7.centos.noarch.rpm
Downloading centos-release-7-9.2009.1.el7.centos.x86_64.rpm
Downloading chkconfig-1.7.6-1.el7.x86_64.rpm
Downloading coreutils-8.22-24.el7_9.2.x86_64.rpm
Downloading cpio-2.11-28.el7.x86_64.rpm
Downloading cracklib-2.9.0-11.el7.x86_64.rpm
Downloading cracklib-2.9.0-11.el7.i686.rpm
Downloading cracklib-dicts-2.9.0-11.el7.x86_64.rpm
Downloading cryptsetup-libs-2.0.3-6.el7.x86_64.rpm
Downloading curl-7.29.0-59.el7_9.1.x86_64.rpm
Downloading cyrus-sasl-lib-2.1.26-24.el7_9.x86_64.rpm
Downloading cyrus-sasl-lib-2.1.26-24.el7_9.i686.rpm
Downloading dbus-1.10.24-15.el7.x86_64.rpm
Downloading dbus-libs-1.10.24-15.el7.x86_64.rpm
Downloading device-mapper-1.02.170-6.el7_9.5.x86_64.rpm
Downloading device-mapper-libs-1.02.170-6.el7_9.5.i686.rpm
Downloading device-mapper-libs-1.02.170-6.el7_9.5.x86_64.rpm
Downloading diffutils-3.3-5.el7.i686.rpm
Downloading diffutils-3.3-5.el7.x86_64.rpm
Downloading dracut-033-572.el7.x86_64.rpm
Downloading elfutils-default-yama-scope-0.176-5.el7.noarch.rpm
Downloading elfutils-libelf-0.176-5.el7.x86_64.rpm
Downloading elfutils-libelf-0.176-5.el7.i686.rpm
Downloading elfutils-libs-0.176-5.el7.x86_64.rpm
Downloading elfutils-libs-0.176-5.el7.i686.rpm
Downloading expat-2.1.0-14.el7_9.x86_64.rpm
Downloading filesystem-3.2-25.el7.x86_64.rpm
Downloading findutils-4.5.11-6.el7.x86_64.rpm
Downloading gawk-4.0.2-4.el7_3.1.x86_64.rpm
Downloading glib2-2.56.1-9.el7_9.i686.rpm
Downloading glib2-2.56.1-9.el7_9.x86_64.rpm
Downloading glibc-2.17-326.el7_9.i686.rpm
Downloading glibc-2.17-326.el7_9.x86_64.rpm
Downloading glibc-common-2.17-326.el7_9.x86_64.rpm
Downloading gmp-6.0.0-15.el7.i686.rpm
Downloading gmp-6.0.0-15.el7.x86_64.rpm
Downloading grep-2.20-3.el7.x86_64.rpm
Downloading gzip-1.5-11.el7_9.x86_64.rpm
Downloading hardlink-1.0-19.el7.x86_64.rpm
Downloading info-5.1-5.el7.x86_64.rpm
Downloading json-c-0.11-4.el7_0.x86_64.rpm
Downloading keyutils-libs-1.5.8-3.el7.i686.rpm
Downloading keyutils-libs-1.5.8-3.el7.x86_64.rpm
Downloading kmod-20-28.el7.x86_64.rpm
Downloading kmod-libs-20-28.el7.x86_64.rpm
Downloading kpartx-0.4.9-135.el7_9.x86_64.rpm
Downloading krb5-libs-1.15.1-51.el7_9.i686.rpm
Downloading krb5-libs-1.15.1-51.el7_9.x86_64.rpm
Downloading libacl-2.2.51-15.el7.x86_64.rpm
Downloading libacl-2.2.51-15.el7.i686.rpm
Downloading libattr-2.4.46-13.el7.i686.rpm
Downloading libattr-2.4.46-13.el7.x86_64.rpm
Downloading libblkid-2.23.2-65.el7_9.1.i686.rpm
Downloading libblkid-2.23.2-65.el7_9.1.x86_64.rpm
Downloading libcap-2.22-11.el7.x86_64.rpm
Downloading libcap-2.22-11.el7.i686.rpm
Downloading libcap-ng-0.7.5-4.el7.i686.rpm
Downloading libcap-ng-0.7.5-4.el7.x86_64.rpm
Downloading libcom_err-1.42.9-19.el7.x86_64.rpm
Downloading libcom_err-1.42.9-19.el7.i686.rpm
Downloading libcurl-7.29.0-59.el7_9.1.i686.rpm
Downloading libcurl-7.29.0-59.el7_9.1.x86_64.rpm
Downloading libdb-5.3.21-25.el7.i686.rpm
Downloading libdb-5.3.21-25.el7.x86_64.rpm
Downloading libdb-utils-5.3.21-25.el7.x86_64.rpm
Downloading libffi-3.0.13-19.el7.i686.rpm
Downloading libffi-3.0.13-19.el7.x86_64.rpm
Downloading libgcc-4.8.5-44.el7.x86_64.rpm
Downloading libgcc-4.8.5-44.el7.i686.rpm
Downloading libgcrypt-1.5.3-14.el7.x86_64.rpm
Downloading libgcrypt-1.5.3-14.el7.i686.rpm
Downloading libgpg-error-1.12-3.el7.i686.rpm
Downloading libgpg-error-1.12-3.el7.x86_64.rpm
Downloading libidn-1.28-4.el7.i686.rpm
Downloading libidn-1.28-4.el7.x86_64.rpm
Downloading libmount-2.23.2-65.el7_9.1.i686.rpm
Downloading libmount-2.23.2-65.el7_9.1.x86_64.rpm
Downloading libpwquality-1.2.3-5.el7.i686.rpm
Downloading libpwquality-1.2.3-5.el7.x86_64.rpm
Downloading libselinux-2.5-15.el7.x86_64.rpm
Downloading libselinux-2.5-15.el7.i686.rpm
Downloading libsemanage-2.5-14.el7.x86_64.rpm
Downloading libsepol-2.5-10.el7.i686.rpm
Downloading libsepol-2.5-10.el7.x86_64.rpm
Downloading libsmartcols-2.23.2-65.el7_9.1.i686.rpm
Downloading libsmartcols-2.23.2-65.el7_9.1.x86_64.rpm
Downloading libssh2-1.8.0-4.el7.x86_64.rpm
Downloading libssh2-1.8.0-4.el7.i686.rpm
Downloading libstdc++-4.8.5-44.el7.i686.rpm
Downloading libstdc++-4.8.5-44.el7.x86_64.rpm
Downloading libtasn1-4.10-1.el7.i686.rpm
Downloading libtasn1-4.10-1.el7.x86_64.rpm
Downloading libuser-0.60-9.el7.i686.rpm
Downloading libuser-0.60-9.el7.x86_64.rpm
Downloading libutempter-1.1.6-4.el7.x86_64.rpm
Downloading libutempter-1.1.6-4.el7.i686.rpm
Downloading libuuid-2.23.2-65.el7_9.1.x86_64.rpm
Downloading libuuid-2.23.2-65.el7_9.1.i686.rpm
Downloading libverto-0.2.5-4.el7.i686.rpm
Downloading libverto-0.2.5-4.el7.x86_64.rpm
Downloading libxml2-2.9.1-6.el7_9.6.x86_64.rpm
Downloading lua-5.1.4-15.el7.x86_64.rpm
Downloading lz4-1.8.3-1.el7.x86_64.rpm
Downloading lz4-1.8.3-1.el7.i686.rpm
Downloading make-3.82-24.el7.x86_64.rpm
Downloading ncurses-5.9-14.20130511.el7_4.x86_64.rpm
Downloading ncurses-base-5.9-14.20130511.el7_4.noarch.rpm
Downloading ncurses-libs-5.9-14.20130511.el7_4.x86_64.rpm
Downloading ncurses-libs-5.9-14.20130511.el7_4.i686.rpm
Downloading nspr-4.32.0-1.el7_9.x86_64.rpm
Downloading nspr-4.32.0-1.el7_9.i686.rpm
Downloading nss-3.67.0-4.el7_9.x86_64.rpm
Downloading nss-3.67.0-4.el7_9.i686.rpm
Downloading nss-pem-1.0.3-7.el7.x86_64.rpm
Downloading nss-pem-1.0.3-7.el7.i686.rpm
Downloading nss-softokn-3.67.0-3.el7_9.x86_64.rpm
Downloading nss-softokn-3.67.0-3.el7_9.i686.rpm
Downloading nss-softokn-freebl-3.67.0-3.el7_9.i686.rpm
Downloading nss-softokn-freebl-3.67.0-3.el7_9.x86_64.rpm
Downloading nss-sysinit-3.67.0-4.el7_9.x86_64.rpm
Downloading nss-tools-3.67.0-4.el7_9.x86_64.rpm
Downloading nss-util-3.67.0-1.el7_9.i686.rpm
Downloading nss-util-3.67.0-1.el7_9.x86_64.rpm
Downloading openldap-2.4.44-25.el7_9.i686.rpm
Downloading openldap-2.4.44-25.el7_9.x86_64.rpm
Downloading openssl-1.0.2k-25.el7_9.x86_64.rpm
Downloading openssl-libs-1.0.2k-25.el7_9.x86_64.rpm
Downloading openssl-libs-1.0.2k-25.el7_9.i686.rpm
Downloading p11-kit-0.23.5-3.el7.i686.rpm
Downloading p11-kit-0.23.5-3.el7.x86_64.rpm
Downloading p11-kit-trust-0.23.5-3.el7.i686.rpm
Downloading p11-kit-trust-0.23.5-3.el7.x86_64.rpm
Downloading pam-1.1.8-23.el7.x86_64.rpm
Downloading pam-1.1.8-23.el7.i686.rpm
Downloading pcre-8.32-17.el7.i686.rpm
Downloading pcre-8.32-17.el7.x86_64.rpm
Downloading pkgconfig-0.27.1-4.el7.x86_64.rpm
Downloading pkgconfig-0.27.1-4.el7.i686.rpm
Downloading popt-1.13-16.el7.i686.rpm
Downloading popt-1.13-16.el7.x86_64.rpm
Downloading procps-ng-3.3.10-28.el7.x86_64.rpm
Downloading procps-ng-3.3.10-28.el7.i686.rpm
Downloading qrencode-libs-3.4.1-3.el7.x86_64.rpm
Downloading readline-6.2-11.el7.i686.rpm
Downloading readline-6.2-11.el7.x86_64.rpm
Downloading rpm-4.11.3-48.el7_9.x86_64.rpm
Downloading rpm-libs-4.11.3-48.el7_9.x86_64.rpm
Downloading sed-4.2.2-7.el7.x86_64.rpm
Downloading setup-2.8.71-11.el7.noarch.rpm
Downloading shadow-utils-4.6-5.el7.x86_64.rpm
Downloading shared-mime-info-1.8-5.el7.x86_64.rpm
Downloading sqlite-3.7.17-8.el7_7.1.i686.rpm
Downloading sqlite-3.7.17-8.el7_7.1.x86_64.rpm
Downloading systemd-219-78.el7_9.5.x86_64.rpm
Downloading systemd-libs-219-78.el7_9.5.i686.rpm
Downloading systemd-libs-219-78.el7_9.5.x86_64.rpm
Downloading tar-1.26-35.el7.x86_64.rpm
Downloading tzdata-2022a-1.el7.noarch.rpm
Downloading ustr-1.0.4-16.el7.x86_64.rpm
Downloading util-linux-2.23.2-65.el7_9.1.x86_64.rpm
Downloading util-linux-2.23.2-65.el7_9.1.i686.rpm
Downloading xz-5.2.2-1.el7.x86_64.rpm
Downloading xz-libs-5.2.2-1.el7.x86_64.rpm
Downloading xz-libs-5.2.2-1.el7.i686.rpm
Downloading zlib-1.2.7-20.el7_9.x86_64.rpm
Downloading zlib-1.2.7-20.el7_9.i686.rpm
5. 安装 nginx
将 nginx 程序包和依赖包全部拷贝至内网机中,使用该命令安装
rpm -Uvh --nodeps nginx-1.20.1-9.el7.x86_64.rpm
[root@master1 ~]# rpm -Uvh --nodeps nginx-1.20.1-9.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:nginx-1:1.20.1-9.el7 ################################# [100%]
警告:用户nginx 不存在 - 使用root
警告:用户nginx 不存在 - 使用root
6. 启动 nginx
systemctl start nginx
附件:已打包上传所有相关依赖包和本文档 pdf 版,仅供参考。