.png)
CentOS 7에 Nginx 1.16 설치(SCL)
소개
Software Collection (SCL)을 사용하여 CentOS7에 Nginx1.16 설치
상위 기사 : Nginx의 다양한 설치 방법과 EOL 요약
참고 : Quick Start — Software Collections
지원
본 방법으로 도입한 경우, Red Hat Software Collections Product Life Cycle - Red Hat Customer Portal 보다, 2021-12가 EOL이라고 생각된다.
그 이후에 보고된 취약성이나 결함에 대한 대응은 실시되지 않을 가능성이 있다.
LOG
리포지토리 등록
# yum install -y centos-release-scl
설치
CentOS7.7이라고 부팅하지 않았기 때문에 7.6을 사용하고 있습니다.
Systemd error: 'Refusing to accept PID outside of service control group, acquired through unsafe symlink chain' - Red Hat Customer Portal 가 영향을 미칠지도 모르지만 조사되지 않았다.
# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
# yum install -y rh-nginx116 which
# scl enable rh-nginx116 bash
... 略
nginx 시작/중지
# systemctl start rh-nginx116-nginx
# systemctl status -l rh-nginx116-nginx
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2020-01-30 03:30:15 UTC; 5s ago
Process: 1431 ExecStart=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 1425 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 1418 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx116 (code=exited, status=0/SUCCESS)
Process: 1417 ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx116/run/nginx/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 1437 (nginx)
CGroup: /docker/285f4a924c86a08e019904bd193ea56b61ec9cf87e8fa795e3855778d20f6f4d/system.slice/rh-nginx116-nginx.service
tq1437 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
mq1438 nginx: worker process
? 1437 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
Jan 30 03:30:15 285f4a924c86 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: the configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf syntax is ok
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf test is successful
Jan 30 03:30:15 285f4a924c86 systemd[1]: Failed to read PID from file /var/opt/rh/rh-nginx116/run/nginx/nginx.pid: Invalid argument
Jan 30 03:30:15 285f4a924c86 systemd[1]: Started The nginx HTTP and reverse proxy server.
# systemctl stop rh-nginx116-nginx
# systemctl status -l rh-nginx116-nginx
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Jan 30 03:30:15 285f4a924c86 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: the configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf syntax is ok
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf test is successful
Jan 30 03:30:15 285f4a924c86 systemd[1]: Failed to read PID from file /var/opt/rh/rh-nginx116/run/nginx/nginx.pid: Invalid argument
Jan 30 03:30:15 285f4a924c86 systemd[1]: Started The nginx HTTP and reverse proxy server.
Jan 30 03:30:46 285f4a924c86 systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Jan 30 03:30:46 285f4a924c86 systemd[1]: Stopped The nginx HTTP and reverse proxy server.
CentOS7.7에서 발생한 오류
# systemctl start rh-nginx116-nginx
Job for rh-nginx116-nginx.service failed because a timeout was exceeded. See "systemctl status rh-nginx116-nginx.service" and "journalctl -xe" for details.
# systemctl status -l rh-nginx116-nginx.service
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: timeout) since Thu 2020-01-30 03:37:24 UTC; 31s ago
Process: 1744 ExecStart=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 1738 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 1731 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx116 (code=exited, status=0/SUCCESS)
Process: 1730 ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx116/run/nginx/nginx.pid (code=exited, status=0/SUCCESS)
CGroup: /docker/285f4a924c86a08e019904bd193ea56b61ec9cf87e8fa795e3855778d20f6f4d/docker/285f4a924c86a08e019904bd193ea56b61ec9cf87e8fa795e3855778d20f6f4d/system.slice/rh-nginx116-nginx.service
tq1750 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
mq1751 nginx: worker process
Jan 30 03:35:54 285f4a924c86 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 30 03:35:54 285f4a924c86 nginx-scl-helper[1738]: nginx: the configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf syntax is ok
Jan 30 03:35:54 285f4a924c86 nginx-scl-helper[1738]: nginx: configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf test is successful
Jan 30 03:35:54 285f4a924c86 systemd[1]: Failed to parse PID from file /var/opt/rh/rh-nginx116/run/nginx/nginx.pid: Invalid argument
Jan 30 03:35:54 285f4a924c86 systemd[1]: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain: /var/opt/rh/rh-nginx116/run/nginx/nginx.pid
Jan 30 03:37:24 285f4a924c86 systemd[1]: rh-nginx116-nginx.service start operation timed out. Terminating.
Jan 30 03:37:24 285f4a924c86 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jan 30 03:37:24 285f4a924c86 systemd[1]: Unit rh-nginx116-nginx.service entered failed state.
Jan 30 03:37:24 285f4a924c86 systemd[1]: rh-nginx116-nginx.service failed.
nginx 자동 시작 설정/설정 해제
# systemctl enable rh-nginx116-nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
# systemctl list-unit-files --type=service |grep nginx
rh-nginx116-nginx.service enabled
# systemctl disable rh-nginx116-nginx
Removed symlink /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service.
# systemctl list-unit-files --type=service |grep nginx
rh-nginx116-nginx.service disabled
각종 확인
# which nginx
/opt/rh/rh-nginx116/root/usr/sbin/nginx
# nginx -v
nginx version: nginx/1.16.1
# yum info rh-nginx116
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: ftp.riken.jp
* centos-sclo-rh: ftp.riken.jp
* centos-sclo-sclo: ftp.riken.jp
* extras: ftp.riken.jp
* updates: ftp.riken.jp
Installed Packages
Name : rh-nginx116
Arch : x86_64
Version : 1.16
Release : 1.el7
Size : 0.0
Repo : installed
From repo : centos-sclo-rh
Summary : Package that installs rh-nginx116
License : GPLv2+
Description : This is the main package for rh-nginx116 Software Collection.
# yum install -y centos-release-scl
# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
# yum install -y rh-nginx116 which
# scl enable rh-nginx116 bash
... 略
# systemctl start rh-nginx116-nginx
# systemctl status -l rh-nginx116-nginx
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2020-01-30 03:30:15 UTC; 5s ago
Process: 1431 ExecStart=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 1425 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 1418 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx116 (code=exited, status=0/SUCCESS)
Process: 1417 ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx116/run/nginx/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 1437 (nginx)
CGroup: /docker/285f4a924c86a08e019904bd193ea56b61ec9cf87e8fa795e3855778d20f6f4d/system.slice/rh-nginx116-nginx.service
tq1437 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
mq1438 nginx: worker process
? 1437 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
Jan 30 03:30:15 285f4a924c86 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: the configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf syntax is ok
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf test is successful
Jan 30 03:30:15 285f4a924c86 systemd[1]: Failed to read PID from file /var/opt/rh/rh-nginx116/run/nginx/nginx.pid: Invalid argument
Jan 30 03:30:15 285f4a924c86 systemd[1]: Started The nginx HTTP and reverse proxy server.
# systemctl stop rh-nginx116-nginx
# systemctl status -l rh-nginx116-nginx
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Jan 30 03:30:15 285f4a924c86 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: the configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf syntax is ok
Jan 30 03:30:15 285f4a924c86 nginx-scl-helper[1425]: nginx: configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf test is successful
Jan 30 03:30:15 285f4a924c86 systemd[1]: Failed to read PID from file /var/opt/rh/rh-nginx116/run/nginx/nginx.pid: Invalid argument
Jan 30 03:30:15 285f4a924c86 systemd[1]: Started The nginx HTTP and reverse proxy server.
Jan 30 03:30:46 285f4a924c86 systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Jan 30 03:30:46 285f4a924c86 systemd[1]: Stopped The nginx HTTP and reverse proxy server.
# systemctl start rh-nginx116-nginx
Job for rh-nginx116-nginx.service failed because a timeout was exceeded. See "systemctl status rh-nginx116-nginx.service" and "journalctl -xe" for details.
# systemctl status -l rh-nginx116-nginx.service
● rh-nginx116-nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/rh-nginx116-nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: timeout) since Thu 2020-01-30 03:37:24 UTC; 31s ago
Process: 1744 ExecStart=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 1738 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /opt/rh/rh-nginx116/root/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 1731 ExecStartPre=/opt/rh/rh-nginx116/root/usr/libexec/nginx-scl-helper enable $RH_NGINX116_SCLS_ENABLED -- /usr/bin/scl_enabled rh-nginx116 (code=exited, status=0/SUCCESS)
Process: 1730 ExecStartPre=/usr/bin/rm -f /var/opt/rh/rh-nginx116/run/nginx/nginx.pid (code=exited, status=0/SUCCESS)
CGroup: /docker/285f4a924c86a08e019904bd193ea56b61ec9cf87e8fa795e3855778d20f6f4d/docker/285f4a924c86a08e019904bd193ea56b61ec9cf87e8fa795e3855778d20f6f4d/system.slice/rh-nginx116-nginx.service
tq1750 nginx: master process /opt/rh/rh-nginx116/root/usr/sbin/nginx
mq1751 nginx: worker process
Jan 30 03:35:54 285f4a924c86 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 30 03:35:54 285f4a924c86 nginx-scl-helper[1738]: nginx: the configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf syntax is ok
Jan 30 03:35:54 285f4a924c86 nginx-scl-helper[1738]: nginx: configuration file /etc/opt/rh/rh-nginx116/nginx/nginx.conf test is successful
Jan 30 03:35:54 285f4a924c86 systemd[1]: Failed to parse PID from file /var/opt/rh/rh-nginx116/run/nginx/nginx.pid: Invalid argument
Jan 30 03:35:54 285f4a924c86 systemd[1]: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain: /var/opt/rh/rh-nginx116/run/nginx/nginx.pid
Jan 30 03:37:24 285f4a924c86 systemd[1]: rh-nginx116-nginx.service start operation timed out. Terminating.
Jan 30 03:37:24 285f4a924c86 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jan 30 03:37:24 285f4a924c86 systemd[1]: Unit rh-nginx116-nginx.service entered failed state.
Jan 30 03:37:24 285f4a924c86 systemd[1]: rh-nginx116-nginx.service failed.
# systemctl enable rh-nginx116-nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
# systemctl list-unit-files --type=service |grep nginx
rh-nginx116-nginx.service enabled
# systemctl disable rh-nginx116-nginx
Removed symlink /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service.
# systemctl list-unit-files --type=service |grep nginx
rh-nginx116-nginx.service disabled
# which nginx
/opt/rh/rh-nginx116/root/usr/sbin/nginx
# nginx -v
nginx version: nginx/1.16.1
# yum info rh-nginx116
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: ftp.riken.jp
* centos-sclo-rh: ftp.riken.jp
* centos-sclo-sclo: ftp.riken.jp
* extras: ftp.riken.jp
* updates: ftp.riken.jp
Installed Packages
Name : rh-nginx116
Arch : x86_64
Version : 1.16
Release : 1.el7
Size : 0.0
Repo : installed
From repo : centos-sclo-rh
Summary : Package that installs rh-nginx116
License : GPLv2+
Description : This is the main package for rh-nginx116 Software Collection.