RHEL 8에 Nginx 1.16 설치(AppStream)

RHEL 8에 Nginx 1.16 설치(AppStream)

2022-10-05 last update

8 minutes reading RHEL8 appstream nginx

소개



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이라고 생각된다.
그 이후에 보고된 취약성이나 결함에 대한 대응은 실시되지 않을 가능성이 있다.

LOG



설치


# 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

각종 확인


# 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