nginx安装演示(离线安装,直接安装在Linux中)

发布于:2024-07-10 ⋅ 阅读:(122) ⋅ 点赞:(0)

1、创建文件夹 tool / nginx

[root@localhost ~]# cd /opt/
[root@localhost opt]# mkdir tool
[root@localhost opt]# cd tool/
[root@localhost tool]# mkdir nginx
[root@localhost tool]# cd nginx/
[root@localhost nginx]# pwd
/opt/tool/nginx
[root@localhost nginx]# 

在这里插入图片描述

2、把安装文件放到 /opt/tool/nginx 目录下面

在这里插入图片描述

在这里插入图片描述

[root@localhost nginx]# pwd
/opt/tool/nginx
[root@localhost nginx]# ls
nginx-1.20.1.tar.gz  openssl-1.0.1t.tar.gz  pcre-8.37.tar.gz  zlib-1.2.8.tar.gz
[root@localhost nginx]# 

3、yum install gcc

[root@localhost nginx]# yum install gcc
已加载插件:fastestmirror, langpacks                                                                                                      | 2.9 kB  00:00:00     
Determining fastest mirrors
 * base: mirrors.nju.edu.cn
 * centos-sclo-rh: mirrors.nju.edu.cn
 * centos-sclo-sclo: mirrors.163.com
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
软件包 gcc-4.8.5-44.el7.x86_64 已安装并且是最新版本
无须任何处理

4、yum install gcc-c++

[root@localhost nginx]# yum install gcc-c++
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.nju.edu.cn
 * centos-sclo-rh: mirrors.nju.edu.cn
 * centos-sclo-sclo: mirrors.163.com
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc-c++.x86_64.0.4.8.5-44.el7 将被 安装
--> 正在处理依赖关系 libstdc++-devel = 4.8.5-44.el7,它被软件包 gcc-c++-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libstdc++ = 4.8.5-44.el7,它被软件包 gcc-c++-4.8.5-44.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libstdc++.x86_64.0.4.8.5-16.el7 将被 升级
---> 软件包 libstdc++.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libstdc++-devel.x86_64.0.4.8.5-44.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================================================================================
 Package                                 架构                           版本                                 源                            大小
================================================================================================================================================
正在安装:
 gcc-c++                                 x86_64                         4.8.5-44.el7                         base                         7.2 M
为依赖而安装:
 libstdc++-devel                         x86_64                         4.8.5-44.el7                         base                         1.5 M
为依赖而更新:
 libstdc++                               x86_64                         4.8.5-44.el7                         base                         306 k

事务概要
================================================================================================================================================
安装  1 软件包 (+1 依赖软件包)
升级           ( 1 依赖软件包)

总计:9.0 M
总下载量:8.7 M
Is this ok [y/d/N]: y
Downloading packages:
gcc-c++-4.8.5-44.el7.x86_64.rp FAILED                                                                         ]  0.0 B/s |    0 B  --:--:-- ETA 
http://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/gcc-c%2B%2B-4.8.5-44.el7.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found-:--:-- ETA 
正在尝试其它镜像。
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

(1/2): libstdc++-devel-4.8.5-44.el7.x86_64.rpm                                                                           | 1.5 MB  00:00:01     
gcc-c++-4.8.5-44.el7.x86_64.rp FAILED                                          
http://mirrors.bupt.edu.cn/centos/7.9.2009/os/x86_64/Packages/gcc-c%2B%2B-4.8.5-44.el7.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found:04 ETA 
正在尝试其它镜像。
(2/2): gcc-c++-4.8.5-44.el7.x86_64.rpm                                                                                   | 7.2 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                            2.4 MB/s | 8.7 MB  00:00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : libstdc++-4.8.5-44.el7.x86_64                                                                                               1/4 
  正在安装    : libstdc++-devel-4.8.5-44.el7.x86_64                                                                                         2/4 
  正在安装    : gcc-c++-4.8.5-44.el7.x86_64                                                                                                 3/4 
  清理        : libstdc++-4.8.5-16.el7.x86_64                                                                                               4/4 
  验证中      : gcc-c++-4.8.5-44.el7.x86_64                                                                                                 1/4 
  验证中      : libstdc++-devel-4.8.5-44.el7.x86_64                                                                                         2/4 
  验证中      : libstdc++-4.8.5-44.el7.x86_64                                                                                               3/4 
  验证中      : libstdc++-4.8.5-16.el7.x86_64                                                                                               4/4 

已安装:
  gcc-c++.x86_64 0:4.8.5-44.el7                                                                                                                 

作为依赖被安装:
  libstdc++-devel.x86_64 0:4.8.5-44.el7                                                                                                         

作为依赖被升级:
  libstdc++.x86_64 0:4.8.5-44.el7                                                                                                               

完毕!

5、tar -zxvf pcre-8.37.tar.gz

[root@localhost nginx]# tar -zxvf pcre-8.37.tar.gz 
pcre-8.37/
pcre-8.37/pcre_scanner.h
pcre-8.37/LICENCE
pcre-8.37/makevp_c.txt
pcre-8.37/PrepareRelease
pcre-8.37/RunTest.bat
pcre-8.37/pcre16_study.c
pcre-8.37/pcre16_chartables.c

6、./configure

[root@localhost nginx]# cd pcre-8.37/
[root@localhost pcre-8.37]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes

7、make

[root@localhost pcre-8.37]# make
rm -f pcre_chartables.c
ln -s ./pcre_chartables.c.dist pcre_chartables.c
make  all-am
make[1]: 进入目录“/opt/tool/nginx/pcre-8.37”
  CC       libpcre_la-pcre_byte_order.lo
  CC       libpcre_la-pcre_compile.lo
  CC       libpcre_la-pcre_config.lo
  CC       libpcre_la-pcre_dfa_exec.lo

8、make install

[root@localhost pcre-8.37]# make install
make  install-am
make[1]: 进入目录“/opt/tool/nginx/pcre-8.37”
make[2]: 进入目录“/opt/tool/nginx/pcre-8.37”
 /usr/bin/mkdir -p '/usr/local/lib'

9、tar -zxvf openssl-1.0.1t.tar.gz

[root@localhost nginx]# ll
总用量 8064
-rw-r--r--. 1 root root 1061461 39 2023 nginx-1.20.1.tar.gz
-rw-r--r--. 1 root root 4556447 39 2023 openssl-1.0.1t.tar.gz
drwxr-xr-x. 9 1169 1169   12288 74 23:33 pcre-8.37
-rw-r--r--. 1 root root 2041593 39 2023 pcre-8.37.tar.gz
-rw-r--r--. 1 root root  571091 39 2023 zlib-1.2.8.tar.gz
[root@localhost nginx]# tar -zxvf openssl-1.0.1t.tar.gz 
openssl-1.0.1t/ACKNOWLEDGMENTS
openssl-1.0.1t/apps/
openssl-1.0.1t/apps/app_rand.c
openssl-1.0.1t/apps/apps.c
openssl-1.0.1t/apps/apps.h
openssl-1.0.1t/apps/asn1pars.c

在这里插入图片描述

10、./config

[root@localhost nginx]# cd openssl-1.0.1t/
[root@localhost openssl-1.0.1t]# ./config
Operating system: x86_64-whatever-linux2
Configuring for linux-x86_64
Configuring for linux-x86_64
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)

11、/config

[root@localhost nginx]# cd openssl-1.0.1t/
[root@localhost openssl-1.0.1t]# ./config
Operating system: x86_64-whatever-linux2
Configuring for linux-x86_64
Configuring for linux-x86_64
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)

网站公告

今日签到

点亮在社区的每一天
去签到