SCL을 사용하여 Apache와 PHP를 업데이트하는 방법은 무엇입니까?

SCL을 사용하여 Apache와 PHP를 업데이트하는 방법은 무엇입니까?

SCL을 사용하여 PHP 업그레이드를 테스트하고 있습니다. 테스트는 로컬 가상 머신에서 수행되므로 프로그램을 개발하는 동안 문제가 발생할 수 있습니다. 다음과 같은SCL 저장소Python을 2.7.13으로 업데이트하고 활성화할 수 있었습니다 profiles.d/. 현재 Apache와 PHP를 업그레이드하려고 합니다.

~에 따르면아파치 다운로드최신 버전은 Apache 2.4.29입니다. Apache를 업데이트하려고 하면 다음 yum install httpd과 같은 메시지가 나타납니다.패키지 httpd-2.4.6-67.el7.centos.6.x86_64가 설치되어 있고 최신 상태입니다.. SCL을 사용하면 yum install httpd24Apache 1.18을 설치하려고 시도합니다.

yum search httpd그다지 도움이 되지 않습니다. 패키지를 나열하지만(때때로 SCL을 표시함) 버전 번호가 없습니다.

SCL 프로그램 사용시 최신 Apache, PHP는 어떻게 설치하나요?

답변1

다음은 Apache, Python 및 PHP 업그레이드에 대한 필드 노트입니다. 또한 포함되어 있지만 mod_ssl부족합니다 mod_security. mod_securitySCL에서 찾을 수 없습니다 .

##################################################
# https://access.redhat.com/solutions/527703
# https://www.hogarthuk.com/?q=node/15
# https://developers.redhat.com/blog/2014/03/19/permanently-enable-a-software-collection/

##################################################
# Enable SCL
##################################################
yum -y install centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms

##################################################
# Python 2.7
##################################################
yum -y install python27

# Add enable-scl-python27.sh
cat /etc/profile.d/enable-scl-python27.sh
#!/usr/bin/env bash
source scl_source enable python27

##################################################
# PHP 7.1
##################################################
yum -y install rh-php71 rh-php71-php rh-php71-ssl rh-php71-php-mysqlnd

# Config at /etc/opt/rh/rh-php71/php.ini

# Add enable-scl-php71.sh
cat /etc/profile.d/enable-scl-php71.sh
#!/usr/bin/env bash
source scl_source enable rh-php71

##################################################
# Apache 2.4
##################################################
yum -y install httpd24
yum -y install httpd24-httpd-tools httpd24-mod_php httpd24-mod_ssl

# Add enable-scl-php71.sh
cat /etc/profile.d/enable-scl-httpd24.sh
#!/usr/bin/env bash
source scl_source enable httpd24

# Disable old, enable new
systemctl disable httpd.service
systemctl enable httpd24-httpd.service

# Config at /opt/rh/httpd24/root/etc/httpd/httpd.conf
#        or /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf

# Config at /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf

##################################################
# httpd-ssl-pass-dialog

# The original ssl.conf probably includes this:
# SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

# Change it to this:
# /opt/rh/httpd24/root/usr/libexec/httpd-ssl-pass-dialog

##################################################
# !!! TEST APACHE !!!
apachectl configtest

# ps -aux | egrep 'apache|http'
root      1424  0.1  1.2 319644 13376 ?        Ss   00:54   0:00 /opt/rh/httpd24/root/usr/sbin/httpd -DFOREGROUND
apache    1425  0.0  0.8 361184  8400 ?        Sl   00:54   0:00 /opt/rh/httpd24/root/usr/sbin/httpd -DFOREGROUND
...

##################################################
# Backup fresh CONF
##################################################
cp /etc/opt/rh/rh-php71/php.ini /etc/opt/rh/rh-php71/php.ini.bu
cp /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf.bu
cp /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf.bu

##################################################
# Copy old CONF to new CONF
##################################################
# Copy httpd.conf and ssl.conf from /etc/httpd to /opt/rh/httpd24/root/etc/httpd
# Change SERVER_ROOT from /etc/httpd to /opt/rh/httpd24/root/etc/httpd
# Leave DOCUMENT_ROOT unchanged. The new server can serve from the old location.
# Leave mod_ssl unchanged. The old and new mod_ssl use /etc/pki/tls/certs and /etc/pki/tls/private.
# php.ini is too different between version 5 and version 7. Manually copy the hardening.

##################################################
# Hardening
##################################################
# List unneeded functions from PHP in disable_functions
# Comment unneeded modules in /opt/rh/httpd24/root/etc/httpd/conf.modules.d

##################################################
# Important Diff's after cp
##################################################
diff /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf.bu /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf
diff /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf.bu /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf

관련 정보