Article Directory
1. What is offline installation?
The method of using the offline installation package for software installation is called offline installation.
The offline installation package is also called a complete installation package, which contains all installation files. The opposite is online installation, that is, the network installation method is adopted when conditions permit and the network is good. The disadvantage of the online installation method is that it is easy to wait for a long time or the installation fails under poor network conditions. In this case, only offline installation can be performed.
2. Installation steps
1. The dependencies required to install nginx
1.1 Install gcc and gcc-c++
1.1.1 Download dependent packages
gcc depends on download mirror address:
official website: https://gcc.gnu.org/releases.html
Aliyun mirror site: http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
CentOS mirror site: https://vault.centos.org/7.5.1804/os/x86_64/Packages/
只需下载如下依赖即可:
cpp-4.8.5-44.el7.x86_64.rpm
gcc-4.8.5-44.el7.x86_64.rpm
glibc-devel-2.17-317.el7.x86_64.rpm
glibc-headers-2.17-317.el7.x86_64.rpm
kernel-headers-3.10.0-1160.el7.x86_64.rpm
libmpc-1.0.1-3.el7.x86_64.rpm
mpfr-3.1.1-4.el7.x86_64.rpm
----------------------------------------------
gcc-c++-4.8.5-44.el7.x86_64.rpm
libstdc++-4.8.5-44.el7.x86_64.rpm
libstdc++-devel-4.8.5-44.el7.x86_64.rpm
1.1.2 Upload dependent packages
After the download is complete, upload the dependent package to the server. If the authority is insufficient and cannot be uploaded, you can sudo chmod -R 777 文件夹路径名
increase the authority through the command
1.1.3 Installation dependencies
Enter the upload directory, enter rpm -Uvh *.rpm --nodeps --forc
the command to perform batch installation, and the following picture will appear, indicating that the installation is successful
1.1.4 Verifying the installation
Use the gcc-v and g++ -v commands to view the version. If the version details appear, it means that the offline installation is successful, as shown below:
1.2 install pcre
1.2.1 download pcre
Download address: http://www.pcre.org/
1.2.2 Upload and decompress the installation package
Upload the downloaded installation package to the server, and unzip it, unzip the commandtar -xvf pcre-8.45.tar.gz
1.2.3 Compile and install
Enter the decompression directory and execute the following commands in sequence:
./configure
make
make install
1.3 Download and install zlib
1. 3.1 Download zlib
Download address: http://www.zlib.net/
1.3.2 Upload and decompress the installation package
Upload the downloaded installation package to the server and decompress it
1.3.3 Configuration
Enter the decompression directory and enter./configure
1.3.4 Compile and install
Enter the decompression directory and entermake && make install
1.4 Download and install openssl
tips:检查是否已安装openssl,输入命令`openssl version`,若出现版本信息,则无需安装;若没有安装则继续安装
1.4.1 Download
Address: https://www.openssl.org/source/
1.4.2 Upload and decompress the installation package
Upload the downloaded installation package to the server and decompress it
1.4.3 Configuration
Enter the decompression directory and enter./configure
1.4.4 Compile and install
Enter the decompression directory and entermake && make install
1.4.5 Verification
After the installation is complete, the console input openssl version
, if the version information appears, the installation is successful
2. Download and install nginx
2.1 Download nginx installation package
Download address: https://nginx.org/en/download.html
2.2 Upload and decompress the installation package
Upload the downloaded installation package to the server and decompress it
2.3 configuration
Enter the decompression directory to configure the installation address:./configure --prefix=/home/develop/nginx
2.4 compile
make
2.5 installation
make install
2.6 Check and start
2.6.1 Inspection
Enter the sbin folder in the installation directory, enter ./nginx -t
, and the following figure shows that the installation is successful:
2.6.2 Startup
Start nginx, command:./nginx
2.7 Access
The browser accesses nginx, provided that port 80 can be accessed
2.8 Set to enable self-start
tips:此步骤为可选项
Add the sbin directory of nginx to the rc.local file:
#Edit rc.local file vim /etc/rc.local
#Add the following content in the last line/home/develop/nginx/sbin/nginx
Summarize
The above are the detailed steps to install nginx offline, hoping to help friends in need.