ubuntu系统离线安装nginx详细教程

1.更新联网的ubuntu系统的apt与离线的apt相同版本

在联网的ubuntu系统,用文本编辑器打开/etc/apt/sources.list文件、将特定版本apt(离线ubuntu系统apt)源代码的URL复制并粘贴到文件中运行以下命令来更新软件包列表并升级apt:
sudo apt update

2.安装nginx,并根据提示缺少的依赖继续安装

sudo apt install --download-only XXX下载上述编译安装包,并将deb拷贝到/var/cache/apt/archives后,执行安装指令sudo dpkg -i *.deb;
注:安装后使用 sudo find /var/cache/apt/archives -type f ! -name "lock" -delete可以条件批量删除deb文件
安装完nginx后提示以下文件没安装:
libmpc3 (>= 1.1.0)
linux-libc-dev
libgd3
nginx-full
nginx-light
nginx-extras

安装libgd3提示以下文件没有安装:
libfontconfig1
libjpeg8
libtiff5
libxpm4                             解决方式:同安装nginx操作,安装这几个文件

安装libfontconfig1提示以下文件没有安装:
安装fontconfigconfig提示以下文件没有安装:
Package fonts-dejavu-core is not installed.
  Package ttf-bitstream-vera is not installed.
  Package fonts-liberation is not installed.
  Package fonts-liberation2 is not installed.
  Package fonts-croscore is not installed.
  Package fonts-freefont-otf is not installed.
  Package fonts-freefont-ttf is not installed.
  Package fonts-urw-base35 is not installed.
  Package fonts-texgyre is not installed.     解决方式:同安装nginx操作,安装这几个文件

安装libjpeg8提示以下文件没有安装:
 Package libjpeg-turbo8 is not installed      解决方式:同安装nginx操作,安装这个文件

安装libtiff5提示以下文件没有安装:
Package libjbig0 is not installed                  解决方式:同安装nginx操作,安装这个文件

安装nginx-full提示以下问题:
Package libgd3:amd64 is not configured yet                     解决方式:dpkg --configure libgd3:amd64(可能存在嵌套configure)
Package libnginx-mod-http-image-filter is not configured yet
Package nginx-core is not configured yet

安装nginx-light提示以下问题:
dpkg: regarding nginx-light_1.18.0-6ubuntu14.4_amd64.deb containing nginx-light:
 nginx-light conflicts with nginx-core
  nginx-core (version 1.18.0-6ubuntu14.4) is present and installed.

dpkg: error processing archive nginx-light_1.18.0-6ubuntu14.4_amd64.deb (--install):
 conflicting packages - not installing nginx-light             解决方式:文件有冲突,不用管

安装nginx-extras提示以下问题:
dpkg: regarding nginx-extras_1.18.0-6ubuntu14.4_amd64.deb containing nginx-extras:
 nginx-extras conflicts with nginx-core
  nginx-core (version 1.18.0-6ubuntu14.4) is present and installed.

dpkg: error processing archive nginx-extras_1.18.0-6ubuntu14.4_amd64.deb (--install):
 conflicting packages - not installing nginx-extras            解决方式:文件有冲突,不用管

Package libalgorithm-diff-perl is not installed
Package libhtml-tagset-perl is not installed
Package liburi-perl is not installed
libnginx-mod-http-geoip depends on libgeoip1 (>= 1.6.12); however:
  Package libgeoip1 is not installed
 libnginx-mod-stream-geoip depends on libgeoip1 (>= 1.6.12); however:
  Package libgeoip1 is not installed
dpkg: error processing package libnginx-mod-stream-geoip (--install):
 dependency problems - leaving unconfigured              解决方式:安装前几个文件再重新整体安装

注:以上nginx以及其依赖离线安装包,如果没有联网ubuntu系统的,或者图方便的建议从以下链接直接全部下载:

https://download.csdn.net/download/qq_36882727/88537599

3.nginx -v 发现离线安装成功

你可能感兴趣的:(ubuntu,nginx,linux)