项目中有一台前置机是部署在特定的域中,该机器作为一台数据的中转服务使用,但没有互联网,因此需要在这台机器上使用离线部署的方式安装Nginx,这里记录下过程。
平时使用yum安装依赖的时候只需要使用如下方式
yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
但在离线时我们只能手动安装,这里就需要在https://centos.pkgs.org/找到需要的依赖将其下载下来再传到机器上。
找寻Pkg
替换国内镜像加速下载
下载Pkg
GCC的安装有太多的依赖,并且还有互相依赖。我这里是将依赖的地址全部找到,然后存放在一个文件中,批量下载。
https://mirrors.163.com/centos/7/os/x86_64/Packages/cpp-4.8.5-44.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/gcc-4.8.5-44.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/glibc-2.17-317.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/glibc-common-2.17-317.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/glibc-devel-2.17-317.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/kernel-headers-3.10.0-1160.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/glibc-static-2.17-317.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/glibc-utils-2.17-317.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/libmpc-1.0.1-3.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/mpfr-3.1.1-4.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/gcc-c++-4.8.5-44.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/libstdc++-devel-4.8.5-44.el7.x86_64.rpm
https://mirrors.163.com/centos/7/os/x86_64/Packages/libstdc++-4.8.5-44.el7.x86_64.rpm
wget -P gcc -i url.txt
安装PKG
发送文件到目标服务器需根据自己的实际情况而定,可以使用U盘拷贝,我这里是使用scp命令(之间有专用的网闸进行数据交互)
# 安装GCC
# 这条命令会根据依赖按照顺序安装rpm
cd gcc
rpm -Uvh *.rpm --nodeps --force
# 验证gcc
gcc -v
# 安装pcre
rpm -ivh pcre-8.32-17.el7.x86_64.rpm
rpm -ivh pcre-devel-8.32-17.el7.x86_64.rpm
# 安装zlib
rpm -ivh zlib-1.2.7-18.el7.x86_64.rpm
rpm -ivh zlib-devel-1.2.7-18.el7.x86_64.rpm
OpenSSL
openssl如果使用rpm安装,还需要很多的依赖包,因此使用压缩包安装更简单。
tar zxvf openssl-fips-2.0.16.tar.gz
cd openssl-fips-2.0.16/
./config && make && make install
安装Nginx
tar zxvf nginx-1.18.0.tar.gz -C /usr/local/
cd /usr/local/nginx
./configure && make && make install
文章评论