1.安装java8(百度)
yum install java-1.8.0-openjdk.x86_64
root@canteen jar\]# yum install java-1.8.0-openjdk.x86_64
yum install java-1.8.0-openjdk-devel.x86_64
查java版本:
\[root@localhost \~\]# java -version  
openjdk version "1.8.0_372"  
OpenJDK Runtime Environment (build 1.8.0_372-b07)  
OpenJDK 64-Bit Server VM (build 25.372-b07, mixed mode)
## 2.安装mysql(百度)
https://blog.csdn.net/weixin_42575720/article/details/126056711
https://dev.mysql.com/downloads/repo/yum/  
下载  
Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package 10.9K Download  
(mysql80-community-release-el7-7.noarch.rpm)
    rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
    yum install mysql-community-server
    systemctl start mysqld.service
    grep 'temporary password' /var/log/mysqld.log
    mysql -V
    root@47.92.203.117's password:
    Access denied
    root@47.92.203.117's password:
        ┌──────────────────────────────────────────────────────────────────────┐
        │                 • MobaXterm Personal Edition v24.2 •                 │
        │               (SSH client, X server and network tools)               │
        │                                                                      │
        │ ⮞ SSH session to root@47.92.203.117                                  │
        │   • Direct SSH      :  ✓                                             │
        │   • SSH compression :  ✓                                             │
        │   • SSH-browser     :  ✓                                             │
        │   • X11-forwarding  :  ✗  (disabled or not supported by server)      │
        │                                                                      │
        │ ⮞ For more info, ctrl+click on help or visit our website.            │
        └──────────────────────────────────────────────────────────────────────┘
    Last failed login: Fri Mar 14 14:26:49 CST 2025 from 119.48.197.124 on ssh:notty
    There were 3 failed login attempts since the last successful login.
    Welcome to Alibaba Cloud Elastic Compute Service !
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
    Retrieving https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
    warning: /var/tmp/rpm-tmp.nt5kun: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:mysql80-community-release-el7-11 ################################# [100%]
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# yum install mysql-community-server
    Loaded plugins: fastestmirror
    Determining fastest mirrors
    base                                                                                                                                  | 3.6 kB  00:00:00
    epel                                                                                                                                  | 4.3 kB  00:00:00
    extras                                                                                                                                | 2.9 kB  00:00:00
    mysql-connectors-community                                                                                                            | 2.6 kB  00:00:00
    mysql-tools-community                                                                                                                 | 2.6 kB  00:00:00
    mysql80-community                                                                                                                     | 2.6 kB  00:00:00
    updates                                                                                                                               | 2.9 kB  00:00:00
    (1/10): epel/x86_64/updateinfo                                                                                                        | 1.0 MB  00:00:00
    (2/10): base/7/x86_64/group_gz                                                                                                        | 153 kB  00:00:00
    (3/10): base/7/x86_64/primary_db                                                                                                      | 6.1 MB  00:00:00
    (4/10): extras/7/x86_64/primary_db                                                                                                    | 253 kB  00:00:00
    (5/10): epel/x86_64/primary_db                                                                                                        | 8.7 MB  00:00:00
    (6/10): updates/7/x86_64/primary_db                                                                                                   |  27 MB  00:00:00
    (7/10): mysql-tools-community/x86_64/primary_db                                                                                       | 103 kB  00:00:00
    (8/10): mysql-connectors-community/x86_64/primary_db                                                                                  | 124 kB  00:00:01
    (9/10): mysql80-community/x86_64/primary_db                                                                                           | 322 kB  00:00:01
    (10/10): epel/x86_64/group                                                                                                            | 399 kB  00:00:07
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql-community-server.x86_64 0:8.0.41-1.el7 will be installed
    --> Processing Dependency: mysql-community-common(x86-64) = 8.0.41-1.el7 for package: mysql-community-server-8.0.41-1.el7.x86_64
    --> Processing Dependency: mysql-community-icu-data-files = 8.0.41-1.el7 for package: mysql-community-server-8.0.41-1.el7.x86_64
    --> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.41-1.el7.x86_64
    --> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-8.0.41-1.el7.x86_64
    --> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-8.0.41-1.el7.x86_64
    --> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-8.0.41-1.el7.x86_64
    --> Running transaction check
    ---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
    ---> Package mysql-community-client.x86_64 0:8.0.41-1.el7 will be installed
    --> Processing Dependency: mysql-community-client-plugins = 8.0.41-1.el7 for package: mysql-community-client-8.0.41-1.el7.x86_64
    --> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.41-1.el7.x86_64
    ---> Package mysql-community-common.x86_64 0:8.0.41-1.el7 will be installed
    ---> Package mysql-community-icu-data-files.x86_64 0:8.0.41-1.el7 will be installed
    --> Running transaction check
    ---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
    --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
    --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
    ---> Package mysql-community-client-plugins.x86_64 0:8.0.41-1.el7 will be installed
    ---> Package mysql-community-libs.x86_64 0:8.0.41-1.el7 will be obsoleting
    --> Running transaction check
    ---> Package mysql-community-libs-compat.x86_64 0:8.0.41-1.el7 will be obsoleting
    --> Finished Dependency Resolution
    Dependencies Resolved
    =============================================================================================================================================================
     Package                                           Arch                      Version                              Repository                            Size
    =============================================================================================================================================================
    Installing:
     mysql-community-libs                              x86_64                    8.0.41-1.el7                         mysql80-community                    1.5 M
         replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
     mysql-community-libs-compat                       x86_64                    8.0.41-1.el7                         mysql80-community                    669 k
         replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
     mysql-community-server                            x86_64                    8.0.41-1.el7                         mysql80-community                     65 M
    Installing for dependencies:
     libaio                                            x86_64                    0.3.109-13.el7                       base                                  24 k
     mysql-community-client                            x86_64                    8.0.41-1.el7                         mysql80-community                     16 M
     mysql-community-client-plugins                    x86_64                    8.0.41-1.el7                         mysql80-community                    3.5 M
     mysql-community-common                            x86_64                    8.0.41-1.el7                         mysql80-community                    666 k
     mysql-community-icu-data-files                    x86_64                    8.0.41-1.el7                         mysql80-community                    2.2 M
    Transaction Summary
    =============================================================================================================================================================
    Install  3 Packages (+5 Dependent packages)
    Total download size: 89 M
    Is this ok [y/d/N]: y
    Downloading packages:
    (1/8): libaio-0.3.109-13.el7.x86_64.rpm                                                                                               |  24 kB  00:00:00
    warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.41-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
    Public key for mysql-community-client-plugins-8.0.41-1.el7.x86_64.rpm is not installed
    (2/8): mysql-community-client-plugins-8.0.41-1.el7.x86_64.rpm                                                                         | 3.5 MB  00:00:02
    (3/8): mysql-community-common-8.0.41-1.el7.x86_64.rpm                                                                                 | 666 kB  00:00:00
    (4/8): mysql-community-icu-data-files-8.0.41-1.el7.x86_64.rpm                                                                         | 2.2 MB  00:00:00
    (5/8): mysql-community-libs-8.0.41-1.el7.x86_64.rpm                                                                                   | 1.5 MB  00:00:00
    (6/8): mysql-community-libs-compat-8.0.41-1.el7.x86_64.rpm                                                                            | 669 kB  00:00:00
    (7/8): mysql-community-client-8.0.41-1.el7.x86_64.rpm                                                                                 |  16 MB  00:00:04
    (8/8): mysql-community-server-8.0.41-1.el7.x86_64.rpm                                                                                 |  65 MB  00:00:07
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                        8.1 MB/s |  89 MB  00:00:11
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
    Importing GPG key 0xA8D3785C:
     Userid     : "MySQL Release Engineering "
     Fingerprint: bca4 3417 c3b4 85dd 128e c6d4 b7b3 b788 a8d3 785c
     Package    : mysql80-community-release-el7-11.noarch (installed)
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
    Is this ok [y/N]: y
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
    Importing GPG key 0x3A79BD29:
     Userid     : "MySQL Release Engineering "
     Fingerprint: 859b e8d7 c586 f538 430b 19c2 467b 942d 3a79 bd29
     Package    : mysql80-community-release-el7-11.noarch (installed)
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
    Is this ok [y/N]: y
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    Importing GPG key 0x5072E1F5:
     Userid     : "MySQL Release Engineering "
     Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
     Package    : mysql80-community-release-el7-11.noarch (installed)
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    Is this ok [y/N]: y
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : mysql-community-common-8.0.41-1.el7.x86_64                                                                                                1/9
      Installing : mysql-community-client-plugins-8.0.41-1.el7.x86_64                                                                                        2/9
      Installing : mysql-community-libs-8.0.41-1.el7.x86_64                                                                                                  3/9
      Installing : mysql-community-client-8.0.41-1.el7.x86_64                                                                                                4/9
      Installing : libaio-0.3.109-13.el7.x86_64                                                                                                              5/9
      Installing : mysql-community-icu-data-files-8.0.41-1.el7.x86_64                                                                                        6/9
      Installing : mysql-community-server-8.0.41-1.el7.x86_64                                                                                                7/9
      Installing : mysql-community-libs-compat-8.0.41-1.el7.x86_64                                                                                           8/9
      Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                        9/9
      Verifying  : mysql-community-server-8.0.41-1.el7.x86_64                                                                                                1/9
      Verifying  : mysql-community-client-plugins-8.0.41-1.el7.x86_64                                                                                        2/9
      Verifying  : mysql-community-icu-data-files-8.0.41-1.el7.x86_64                                                                                        3/9
      Verifying  : mysql-community-common-8.0.41-1.el7.x86_64                                                                                                4/9
      Verifying  : mysql-community-libs-8.0.41-1.el7.x86_64                                                                                                  5/9
      Verifying  : mysql-community-libs-compat-8.0.41-1.el7.x86_64                                                                                           6/9
      Verifying  : libaio-0.3.109-13.el7.x86_64                                                                                                              7/9
      Verifying  : mysql-community-client-8.0.41-1.el7.x86_64                                                                                                8/9
      Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                        9/9
    Installed:
      mysql-community-libs.x86_64 0:8.0.41-1.el7       mysql-community-libs-compat.x86_64 0:8.0.41-1.el7       mysql-community-server.x86_64 0:8.0.41-1.el7
    Dependency Installed:
      libaio.x86_64 0:0.3.109-13.el7                mysql-community-client.x86_64 0:8.0.41-1.el7          mysql-community-client-plugins.x86_64 0:8.0.41-1.el7
      mysql-community-common.x86_64 0:8.0.41-1.el7  mysql-community-icu-data-files.x86_64 0:8.0.41-1.el7
    Replaced:
      mariadb-libs.x86_64 1:5.5.68-1.el7
    Complete!
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status mysqld.service
    ● mysqld.service - MySQL Server
       Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
       Active: inactive (dead)
         Docs: man:mysqld(8)
               http://dev.mysql.com/doc/refman/en/using-systemd.html
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl start mysqld.service
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl status mysqld.service
    ● mysqld.service - MySQL Server
       Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
       Active: active (running) since Fri 2025-03-14 14:54:36 CST; 3s ago
         Docs: man:mysqld(8)
               http://dev.mysql.com/doc/refman/en/using-systemd.html
      Process: 11850 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
     Main PID: 11956 (mysqld)
       Status: "Server is operational"
       CGroup: /system.slice/mysqld.service
               └─11956 /usr/sbin/mysqld
    Mar 14 14:54:29 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Starting MySQL Server...
    Mar 14 14:54:36 iZ8vb45ie77v5ybgcemxysZ systemd[1]: Started MySQL Server.
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# grep 'temporary password' /var/log/mysqld.log
    2025-03-14T06:54:32.105792Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ?PAGMK_mn3vX
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# mysql -V
    mysql  Ver 8.0.41 for Linux on x86_64 (MySQL Community Server - GPL)
    [root@iZ8vb45ie77v5ybgcemxysZ ~]#
#yum localinstall mysql80-community-release-el7-7.noarch.rpm  
\[root@iZ0jle5emru0x0swmasdw9Z \~\]# yum module disable mysql  
\[root@iZ0jle5emru0x0swmasdw9Z \~\]# yum install mysql-community-server  
\[root@iZ0jle5emru0x0swmasdw9Z \~\]# systemctl restart mysqld.service  
\[root@iZ0jle5emru0x0swmasdw9Z \~\]# grep 'temporary password' /var/log/mysqld.log  
2023-05-23T04:16:42.251099Z 6 \[Note\] \[MY-010454\] \[Server\] A temporary password is generated for root@localhost: E9ECySg5O)h\>
查mysql版本:
\[root@localhost \~\]# mysql -V  
mysql Ver 8.0.33 for Linux on x86_64 (MySQL Community Server - GPL)
### 2.1 配置mysql
用户名 root 密码 shizan#1234  
进入MySQL: mysql -u root -p  
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Jlrcgzwdb@2650';  
CREATE USER 'developer'@'%' IDENTIFIED BY 'Developer@gzw283';  
GRANT ALL ON \*.\* TO 'developer'@'%' WITH GRANT OPTION;
CREATE USER 'remotedeveloper'@'%' IDENTIFIED BY 'Developer@gzw283';  
GRANT ALL ON \*.\* TO 'remotedeveloper'@'%' WITH GRANT OPTION;
远程登陆  
GRANT ALL PRIVILEGES ON \*.\* TO 'root'@'%' IDENTIFIED BY 'Jlrcgzwdb@2650' WITH GRANT OPTION;  
FLUSH PRIVILEGES;
打开防火墙9090端口
firewall-cmd --zone=public --add-port=9090/tcp --permanent  
重载配置使刚刚设置的开放端口9090生效
firewall-cmd --reload
创建 database:  
cteate database shizan;  
use shizan;  
导入sql  
source /\*/\*.sql;
## 3.安装redis(百度)
    yum install epel-release
    yum install redis
    redis-server -v
建议使用源码安装:
2025年最新redis版本
    wget https://download.redis.io/releases/redis-7.4.2.tar.gz
    tar -zxf redis-7.4.2.tar.gz
    cd redis-7.4.2/
    make
    make install
    /usr/local/bin/redis-server -v
wget https://download.redis.io/releases/redis-7.0.11.tar.gz  
tar -zxf redis-7.0.11.tar.gz  
进入解压目录  
make  
make install  
测试启动  
redis-server
查redis版本:
\[root@localhost \~\]# redis-server -v  
Redis server v=7.0.11 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=9416842c89bef596
密码 mgrensheju@  
redis-server /\*/\*.conf
设置redis 自启动systemctl
    vim /etc/systemd/system/redis.service
    [Unit]
    Description=Redis In-Memory Data Store
    After=network.target
    [Service]
    User=redis
    Group=redis
    ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
    ExecStop=/usr/local/bin/redis-cli shutdown
    Restart=always
    Type=simple
    [Install]
    WantedBy=multi-user.target
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# groupadd redis
    groupadd: group 'redis' already exists
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# id redis
    uid=997(redis) gid=995(redis) groups=995(redis)
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# mkdir -p /var/lib/redis
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# chown redis:redis /var/lib/redis
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# chmod 770 /var/lib/redis
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl daemon-reload
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl start redis
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemctl enable redis
    Failed to execute operation: Bad message
    # 检验/etc/systemd/system/redis.service文件格式
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemd-analyze verify /etc/systemd/system/redis.service
    [/etc/systemd/system/redis.service:1] Assignment outside of section. Ignoring.
    [/etc/systemd/system/redis.service:2] Assignment outside of section. Ignoring.
    [/etc/systemd/system/redis.service:3] Assignment outside of section. Ignoring.
    [root@iZ8vb45ie77v5ybgcemxysZ ~]# systemd-analyze verify /etc/systemd/system/redis.service
    [root@iZ8vb45ie77v5ybgcemxysZ ~]#
## 4.项目目录下运行
java -jar \*.jar
## 5.安装nginx
###### 方法一:使用YUM仓库安装(只有1.20.1版本,没用新版本)
1. 添加EPEL仓库(如果尚未添加): EPEL(Extra Packages for Enterprise Linux)是一个为RHEL和CentOS提供额外软件包的项目。
    sudo yum install epel-release
1. 安装Nginx: 一旦添加了EPEL仓库,就可以使用`yum`来安装Nginx。
    sudo yum install nginx
1. 启动Nginx: 安装完成后,启动Nginx服务。
    sudo systemctl start nginx
1. 设置开机自启: 如果你希望Nginx在系统启动时自动运行,可以设置它为开机自启。
    sudo systemctl enable nginx
1. 检查Nginx状态: 检查Nginx服务的状态。
    sudo systemctl status nginx
    [root@oaserver ~]# yum install epel-release
    已加载插件:fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    base                                                                                                                                         | 3.6 kB  00:00:00
    docker-ce-stable                                                                                                                             | 3.5 kB  00:00:00
    extras                                                                                                                                       | 2.9 kB  00:00:00
    updates                                                                                                                                      | 2.9 kB  00:00:00
    正在解决依赖关系
    --> 正在检查事务
    ---> 软件包 epel-release.noarch.0.7-11 将被 安装
    --> 解决依赖关系完成
    依赖关系解决
    ====================================================================================================================================================================
     Package                                     架构                                  版本                                 源                                     大小
    ====================================================================================================================================================================
    正在安装:
     epel-release                                noarch                                7-11                                 extras                                 15 k
    事务概要
    ====================================================================================================================================================================
    安装  1 软件包
    总下载量:15 k
    安装大小:24 k
    Is this ok [y/d/N]: y
    Downloading packages:
    epel-release-7-11.noarch.rpm                                                                                                                 |  15 kB  00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      正在安装    : epel-release-7-11.noarch                                                                                                                        1/1
      验证中      : epel-release-7-11.noarch                                                                                                                        1/1
    已安装:
      epel-release.noarch 0:7-11
    完毕!
    [root@oaserver ~]# yum install nginx
    已加载插件:fastestmirror
    Loading mirror speeds from cached hostfile
    epel/x86_64/metalink                                                                                                                         | 5.1 kB  00:00:00
     * base: mirrors.aliyun.com
     * epel: repo.jing.rocks
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    epel                                                                                                                                         | 4.3 kB  00:00:00
    (1/3): epel/x86_64/group                                                                                                                     | 399 kB  00:00:01
    (2/3): epel/x86_64/updateinfo                                                                                                                | 1.0 MB  00:00:01
    (3/3): epel/x86_64/primary_db                                                                                                                | 8.7 MB  00:00:03
    正在解决依赖关系
    --> 正在检查事务
    ---> 软件包 nginx.x86_64.1.1.20.1-10.el7 将被 安装
    --> 正在处理依赖关系 nginx-filesystem = 1:1.20.1-10.el7,它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 libcrypto.so.1.1(OPENSSL_1_1_0)(64bit),它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 libssl.so.1.1(OPENSSL_1_1_0)(64bit),它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 libssl.so.1.1(OPENSSL_1_1_1)(64bit),它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 nginx-filesystem,它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 redhat-indexhtml,它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 libcrypto.so.1.1()(64bit),它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 libprofiler.so.0()(64bit),它被软件包 1:nginx-1.20.1-10.el7.x86_64 需要
    --> 正在处理依赖关系 libssl.so.1.1()(64bit),它被软件包 1:nginx-1.20.1-10.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-10.el7 将被 安装
    ---> 软件包 openssl11-libs.x86_64.1.1.1.1k-7.el7 将被 安装
    --> 解决依赖关系完成
    依赖关系解决
    ====================================================================================================================================================================
     Package                                      架构                               版本                                        源                                大小
    ====================================================================================================================================================================
    正在安装:
     nginx                                        x86_64                             1:1.20.1-10.el7                             epel                             588 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-10.el7                             epel                              24 k
     openssl11-libs                               x86_64                             1:1.1.1k-7.el7                              epel                             1.5 M
    事务概要
    ====================================================================================================================================================================
    安装  1 软件包 (+4 依赖软件包)
    总下载量:2.4 M
    安装大小:6.7 M
    Is this ok [y/d/N]: y
    Downloading packages:
    (1/5): centos-indexhtml-7-9.el7.centos.noarch.rpm                                                                                            |  92 kB  00:00:00
    warning: /var/cache/yum/x86_64/7/epel/packages/nginx-1.20.1-10.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY75 kB/s | 340 kB  00:00:12 ETA
    nginx-1.20.1-10.el7.x86_64.rpm 的公钥尚未安装
    (2/5): nginx-1.20.1-10.el7.x86_64.rpm                                                                                                        | 588 kB  00:00:01
    (3/5): gperftools-libs-2.6.1-1.el7.x86_64.rpm                                                                                                | 272 kB  00:00:01
    (4/5): nginx-filesystem-1.20.1-10.el7.noarch.rpm                                                                                             |  24 kB  00:00:00
    (5/5): openssl11-libs-1.1.1k-7.el7.x86_64.rpm                                                                                                | 1.5 MB  00:00:00
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    总计                                                                                                                                1.0 MB/s | 2.4 MB  00:00:02
    从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
    导入 GPG key 0x352C64E5:
     用户ID     : "Fedora EPEL (7) "
     指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
     软件包     : epel-release-7-11.noarch (@extras)
     来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    是否继续?[y/N]:y
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      正在安装    : 1:openssl11-libs-1.1.1k-7.el7.x86_64                                                                                                            1/5
      正在安装    : 1:nginx-filesystem-1.20.1-10.el7.noarch                                                                                                         2/5
      正在安装    : centos-indexhtml-7-9.el7.centos.noarch                                                                                                          3/5
      正在安装    : gperftools-libs-2.6.1-1.el7.x86_64                                                                                                              4/5
      正在安装    : 1:nginx-1.20.1-10.el7.x86_64                                                                                                                    5/5
      验证中      : gperftools-libs-2.6.1-1.el7.x86_64                                                                                                              1/5
      验证中      : centos-indexhtml-7-9.el7.centos.noarch                                                                                                          2/5
      验证中      : 1:nginx-filesystem-1.20.1-10.el7.noarch                                                                                                         3/5
      验证中      : 1:nginx-1.20.1-10.el7.x86_64                                                                                                                    4/5
      验证中      : 1:openssl11-libs-1.1.1k-7.el7.x86_64                                                                                                            5/5
    已安装:
      nginx.x86_64 1:1.20.1-10.el7
    作为依赖被安装:
      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-10.el7   openssl11-libs.x86_64 1:1.1.1k-7.el7
    完毕!
当nginx启动失败且产生如下报错时,原因是80端口被(docker)占用。
    [root@oaserver ~]# systemctl start nginx
    Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service"
    [root@oaserver ~]# systemctl status nginx.service
    ● nginx.service - The nginx HTTP and reverse proxy server
       Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since 五 2024-08-30 15:32:06 CST; 26s ago
      Process: 1956 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
      Process: 1953 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
      Process: 1950 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
    8月 30 15:32:04 oaserver.jlrc nginx[1956]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    8月 30 15:32:05 oaserver.jlrc nginx[1956]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    8月 30 15:32:05 oaserver.jlrc nginx[1956]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    8月 30 15:32:05 oaserver.jlrc nginx[1956]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    8月 30 15:32:05 oaserver.jlrc nginx[1956]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
    8月 30 15:32:06 oaserver.jlrc nginx[1956]: nginx: [emerg] still could not bind()
    8月 30 15:32:06 oaserver.jlrc systemd[1]: nginx.service: control process exited, code=exited status=1
    8月 30 15:32:06 oaserver.jlrc systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
    8月 30 15:32:06 oaserver.jlrc systemd[1]: Unit nginx.service entered failed state.
    8月 30 15:32:06 oaserver.jlrc systemd[1]: nginx.service failed.
当nginx启动失败且产生如下报错时,原因是SELinux处于Enforcing模式。
    [root@oaserver ~]# systemctl start nginx
    Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service"
    [root@oaserver ~]# systemctl status nginx.service
    ● nginx.service - The nginx HTTP and reverse proxy server
       Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since 五 2024-08-30 15:34:36 CST; 5s ago
      Process: 1956 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
      Process: 2898 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
      Process: 2895 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
    8月 30 15:34:35 oaserver.jlrc systemd[1]: Starting The nginx HTTP and reverse proxy server...
    8月 30 15:34:36 oaserver.jlrc nginx[2898]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    8月 30 15:34:36 oaserver.jlrc nginx[2898]: nginx: [emerg] bind() to 0.0.0.0:8001 failed (13: Permission denied)
    8月 30 15:34:36 oaserver.jlrc nginx[2898]: nginx: configuration file /etc/nginx/nginx.conf test failed
    8月 30 15:34:36 oaserver.jlrc systemd[1]: nginx.service: control process exited, code=exited status=1
    8月 30 15:34:36 oaserver.jlrc systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
    8月 30 15:34:36 oaserver.jlrc systemd[1]: Unit nginx.service entered failed state.
    8月 30 15:34:36 oaserver.jlrc systemd[1]: nginx.service failed.
    [root@oaserver ~]# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
检查SELinux状态:如果系统启用了SELinux,它可能会阻止Nginx绑定到指定的端口。
检查SELinux状态:
    getenforce
如果SELinux处于Enforcing模式,尝试将其设置为Permissive模式,然后再次尝试启动Nginx:
    sudo setenforce 0
    sudo systemctl start nginx
当nginx启动后没有报错,但8001仍无法访问时,原因是centos防火墙未开放8001端口。
检查防火墙设置:确保防火墙没有阻止Nginx绑定到端口8001(此处仅以8001端口为例,实际操作时填写使用的端口号)。
    sudo firewall-cmd --permanent --zone=public --add-port=8001/tcp
    sudo firewall-cmd --reload
    [root@oaserver ~]# firewall-cmd --permanent --zone=public --add-port=8001/tcp
    success
    [root@oaserver ~]# firewall-cmd --reload
    success
###### 方法二:编译安装
2025年最新版本
    yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
    wget https://nginx.org/download/nginx-1.27.4.tar.gz
    tar -zxvf nginx-1.27.4.tar.gz
    cd nginx-1.27.4/
    #./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-pcre
    # 编译安装(包含常用模块)
    ./configure \
    --prefix=/usr/local/nginx \
    --with-http_ssl_module \
    --with-http_gzip_static_module \
    --with-pcre \
    --with-http_realip_module \
    --with-http_stub_status_module \
    --with-http_v2_module \
    --with-stream \
    --with-threads
    make
    make install
    /usr/local/nginx/sbin/nginx -V
wget https://nginx.org/download/nginx-1.23.4.tar.gz
tar -zxvf nginx-1.23.4.tar.gz
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel  
进入解压后的目录  
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre  
make  
make install
为nginx增加流媒体(MP4播放)模块
[使用nginx搭建音视频点播服务器 - seedoubleu - 博客园 (cnblogs.com)](https://www.cnblogs.com/seedoubleu/p/15665408.html "使用nginx搭建音视频点播服务器 - seedoubleu - 博客园 (cnblogs.com)")
./configure --prefix=/usr/local/nginx_mp4 --with-http_ssl_module --with-pcre
./configure --prefix=/usr/local/nginx-vod-hls --with-http_stub_status_module --with-http_gzip_static_module --with-http_gunzip_module --with-file-aio --with-threads --with-cc-opt="-O3" --with-http_ssl_module --with-openssl-opt=enable --with-http_mp4_module --with-stream --add-module=../nginx-vod-module-1.31
查nginx版本:
\[root@localhost \~\]# /usr/local/nginx/sbin/nginx -V  
nginx version: nginx/1.23.4  
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)  
built with OpenSSL 1.0.2k-fips 26 Jan 2017  
TLS SNI support enabled  
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre
## 6.安装maven配置环境变量:
[Maven 环境配置 \| 菜鸟教程](https://www.runoob.com/maven/maven-setup.html "Maven 环境配置 | 菜鸟教程")
[打印log-CSDN博客](https://blog.csdn.net/qq_27361945/article/details/150920274 "打印log-CSDN博客")