在RHEL 8上安装Nginx 1.16(通过AppStream)

はじめに

Application Stream(AppStream)を利用してRHEL8にNginx1.16をインストール
親記事:Nginxの各種インストール方法とEOLまとめ
参考:RHEL8のパッケージ構成 – BaseOSとApplication Stream – 赤帽エンジニアブログ

支持

如果使用本方法进行部署,根据Red Hat Enterprise Linux 8 Application Streams Life Cycle – Red Hat Customer Portal,2021-11被认为是EOL(终止生命周期)。在RHEL8.6发布之后,它被更改为2021-10。之后可能不会处理报告的漏洞和问题。

日志

安装

# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.1 (Ootpa)

# yum module reset nginx
# yum install -y @nginx:1.16
... 略

启动/停止nginx

# systemctl start nginx
# systemctl status -l nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           mqphp-fpm.conf
   Active: active (running) since Sun 2019-11-10 09:17:38 UTC; 5s ago
  Process: 246 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 245 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 244 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 252 (nginx)
    Tasks: 2 (limit: 4630)
   Memory: 3.9M
   CGroup: /machine.slice/libpod-a51be7a790a7cf00b566988dba2d9ee826463fffae0c67dd43a00d6deb31d231.scope/system
.slice/nginx.service
           tq252 nginx: master process /usr/sbin/nginx
           mq253 nginx: worker process

Nov 10 09:17:38 a51be7a790a7 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Nov 10 09:17:38 a51be7a790a7 nginx[245]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Nov 10 09:17:38 a51be7a790a7 nginx[245]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Nov 10 09:17:38 a51be7a790a7 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid
argument
Nov 10 09:17:38 a51be7a790a7 systemd[1]: Started The nginx HTTP and reverse proxy server.
# systemctl stop nginx
# systemctl status -l nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           mqphp-fpm.conf
   Active: inactive (dead)

Nov 10 09:17:33 a51be7a790a7 systemd[1]: nginx.service: Unit cannot be reloaded becaus
e it is inactive.
Nov 10 09:17:33 a51be7a790a7 systemd[1]: nginx.service: Unit cannot be reloaded becaus
e it is inactive.
Nov 10 09:17:35 a51be7a790a7 systemd[1]: nginx.service: Unit cannot be reloaded becaus
e it is inactive.
Nov 10 09:17:38 a51be7a790a7 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Nov 10 09:17:38 a51be7a790a7 nginx[245]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Nov 10 09:17:38 a51be7a790a7 nginx[245]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Nov 10 09:17:38 a51be7a790a7 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid
argument
Nov 10 09:17:38 a51be7a790a7 systemd[1]: Started The nginx HTTP and reverse proxy server.
Nov 10 09:18:03 a51be7a790a7 systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Nov 10 09:18:03 a51be7a790a7 systemd[1]: Stopped The nginx HTTP and reverse proxy server.

自动启动/取消Nginx的设置

# systemctl enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

# systemctl list-unit-files --type=service |grep nginx
nginx.service                          enabled
# systemctl disable nginx
Removed /etc/systemd/system/multi-user.target.wants/nginx.service.

# systemctl list-unit-files --type=service |grep nginx
nginx.service                          disabled

各种确认 (Gè

# which nginx
/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.16.1

# yum module info nginx:1.16
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.
Last metadata expiration check: 0:02:54 ago on Sun Nov 10 09:16:37 2019.
Name             : nginx
Stream           : 1.16 [e] [a]
Version          : 8010020190829151810
Context          : cdc1202b
Architecture     : x86_64
Profiles         : common [d] [i]
Default profiles : common
Repo             : rhel-8-for-x86_64-appstream-rpms
Summary          : nginx webserver
Description      : nginx 1.16 webserver module
Artifacts        : nginx-1:1.16.1-1.module+el8.1.0+4097+739b0d87.src
                 : nginx-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-all-modules-1:1.16.1-1.module+el8.1.0+4097+739b0d87.noarch
                 : nginx-debuginfo-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-debugsource-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-filesystem-1:1.16.1-1.module+el8.1.0+4097+739b0d87.noarch
                 : nginx-mod-http-image-filter-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-http-image-filter-debuginfo-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-http-perl-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-http-perl-debuginfo-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-http-xslt-filter-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-http-xslt-filter-debuginfo-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-mail-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-mail-debuginfo-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-stream-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64
                 : nginx-mod-stream-debuginfo-1:1.16.1-1.module+el8.1.0+4097+739b0d87.x86_64

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive
bannerAds