CentOS 6にApache 2.4をインストールしてみました。
通常、Cent OS 6の標準リポジトリでインストールできるのはApache 2.2系になりますが、fedorapeopleサイトにあるepel-httpd24.repoリポジトリを使用すればApache 2.4系がインストールできるようです。
CentOS – install using yum Apache 2.4
http://unix.stackexchange.com/questions/138899/centos-install-using-yum-apache-2-4
検証環境
CentOS release 6.8 (Final)
2.6.32-642.6.1.el6.x86_64
- Apache 2.4 repoのインストール
- Apache 2.4のインストール
- Apache 2.4の構成
- 設定ファイル
- プログラム
- 起動スクリプト
- logrotate
- 起動
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# cd /etc/yum.repos.d/ # curl -O https://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo # ls -l -rw-r--r--. 1 root root 1991 5月 19 04:47 2016 CentOS-Base.repo -rw-r--r--. 1 root root 647 5月 19 04:47 2016 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 630 5月 19 04:47 2016 CentOS-Media.repo -rw-r--r--. 1 root root 6259 5月 19 04:47 2016 CentOS-Vault.repo -rw-r--r--. 1 root root 289 5月 19 04:47 2016 CentOS-fasttrack.repo -rw-r--r--. 1 root root 397 10月 7 22:08 2016 epel-httpd24.repo # cat epel-httpd24.repo # Place this file in your /etc/yum.repos.d/ directory [epel-httpd24] name=httpd-2.4 scl baseurl=http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-$releasever/$basearch/ enabled=1 skip_if_unavailable=1 gpgcheck=0 [epel-httpd24-source] name=httpd-2.4 scl - Source baseurl=http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-$releasever/SRPMS enabled=0 skip_if_unavailable=1 gpgcheck=0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# yum search httpd24 Loaded plugins: fastestmirror, refresh-packagekit Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp ======================================= N/S Matched: httpd24 ======================================== httpd24.x86_64 : Package that installs httpd24 httpd24-apr-debuginfo.x86_64 : Debug information for package httpd24-apr httpd24-apr-util-debuginfo.x86_64 : Debug information for package httpd24-apr-util httpd24-httpd-debuginfo.x86_64 : Debug information for package httpd24-httpd httpd24-runtime.x86_64 : Package that handles httpd24 Software Collection. httpd24-apr.x86_64 : Apache Portable Runtime library httpd24-apr-devel.x86_64 : APR library development kit httpd24-apr-util.x86_64 : Apache Portable Runtime Utility library httpd24-apr-util-devel.x86_64 : APR utility library development kit httpd24-apr-util-ldap.x86_64 : APR utility library LDAP support httpd24-apr-util-mysql.x86_64 : APR utility library MySQL DBD driver httpd24-apr-util-nss.x86_64 : APR utility library NSS crytpo support httpd24-apr-util-odbc.x86_64 : APR utility library ODBC DBD driver httpd24-apr-util-openssl.x86_64 : APR utility library OpenSSL crytpo support httpd24-apr-util-pgsql.x86_64 : APR utility library PostgreSQL DBD driver httpd24-apr-util-sqlite.x86_64 : APR utility library SQLite DBD driver httpd24-build.x86_64 : Package shipping basic build configuration httpd24-httpd.x86_64 : Apache HTTP Server httpd24-httpd-devel.x86_64 : Development interfaces for the Apache HTTP server httpd24-httpd-tools.x86_64 : Tools for use with the Apache HTTP Server httpd24-mod_ldap.x86_64 : LDAP authentication modules for the Apache HTTP Server httpd24-mod_proxy_html.x86_64 : HTML and XML content filters for the Apache HTTP Server httpd24-mod_session.x86_64 : Session interface for the Apache HTTP Server httpd24-mod_ssl.x86_64 : SSL/TLS module for the Apache HTTP Server Name and summary matches only, use "search all" for everything. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# yum install httpd24 Loaded plugins: fastestmirror, refresh-packagekit Setting up Install Process Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp Resolving Dependencies --> Running transaction check ---> Package httpd24.x86_64 0:1-6.el6 will be installed --> Processing Dependency: httpd24-httpd for package: httpd24-1-6.el6.x86_64 --> Processing Dependency: httpd24-apr-util for package: httpd24-1-6.el6.x86_64 --> Processing Dependency: httpd24-apr for package: httpd24-1-6.el6.x86_64 --> Running transaction check ---> Package httpd24-apr.x86_64 0:1.4.8-2.el6 will be installed --> Processing Dependency: httpd24-runtime for package: httpd24-apr-1.4.8-2.el6.x86_64 ---> Package httpd24-apr-util.x86_64 0:1.5.2-5.el6 will be installed ---> Package httpd24-httpd.x86_64 0:2.4.6-5.el6 will be installed --> Processing Dependency: httpd24-httpd-tools = 2.4.6-5.el6 for package: httpd24-httpd-2.4.6-5.el6.x86_64 --> Running transaction check ---> Package httpd24-httpd-tools.x86_64 0:2.4.6-5.el6 will be installed ---> Package httpd24-runtime.x86_64 0:1-6.el6 will be installed --> Processing Dependency: scl-utils for package: httpd24-runtime-1-6.el6.x86_64 --> Running transaction check ---> Package scl-utils.x86_64 0:20120927-27.el6_6 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================== Package Arch Version Repository Size ===================================================================================================== Installing: httpd24 x86_64 1-6.el6 epel-httpd24 2.2 k Installing for dependencies: httpd24-apr x86_64 1.4.8-2.el6 epel-httpd24 96 k httpd24-apr-util x86_64 1.5.2-5.el6 epel-httpd24 87 k httpd24-httpd x86_64 2.4.6-5.el6 epel-httpd24 1.1 M httpd24-httpd-tools x86_64 2.4.6-5.el6 epel-httpd24 73 k httpd24-runtime x86_64 1-6.el6 epel-httpd24 1.0 M scl-utils x86_64 20120927-27.el6_6 base 22 k Transaction Summary ===================================================================================================== Install 7 Package(s) Total download size: 2.4 M Installed size: 4.1 M Is this ok [y/N]: y Downloading Packages: (1/7): httpd24-1-6.el6.x86_64.rpm | 2.2 kB 00:00 (2/7): httpd24-apr-1.4.8-2.el6.x86_64.rpm | 96 kB 00:00 (3/7): httpd24-apr-util-1.5.2-5.el6.x86_64.rpm | 87 kB 00:00 (4/7): httpd24-httpd-2.4.6-5.el6.x86_64.rpm | 1.1 MB 00:01 (5/7): httpd24-httpd-tools-2.4.6-5.el6.x86_64.rpm | 73 kB 00:00 (6/7): httpd24-runtime-1-6.el6.x86_64.rpm | 1.0 MB 00:00 (7/7): scl-utils-20120927-27.el6_6.x86_64.rpm | 22 kB 00:00 ----------------------------------------------------------------------------------------------------- Total 216 kB/s | 2.4 MB 00:11 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : scl-utils-20120927-27.el6_6.x86_64 1/7 Installing : httpd24-runtime-1-6.el6.x86_64 2/7 Installing : httpd24-apr-1.4.8-2.el6.x86_64 3/7 Installing : httpd24-apr-util-1.5.2-5.el6.x86_64 4/7 Installing : httpd24-httpd-tools-2.4.6-5.el6.x86_64 5/7 Installing : httpd24-httpd-2.4.6-5.el6.x86_64 6/7 Installing : httpd24-1-6.el6.x86_64 7/7 Verifying : httpd24-httpd-2.4.6-5.el6.x86_64 1/7 Verifying : httpd24-httpd-tools-2.4.6-5.el6.x86_64 2/7 Verifying : httpd24-1-6.el6.x86_64 3/7 Verifying : httpd24-runtime-1-6.el6.x86_64 4/7 Verifying : scl-utils-20120927-27.el6_6.x86_64 5/7 Verifying : httpd24-apr-util-1.5.2-5.el6.x86_64 6/7 Verifying : httpd24-apr-1.4.8-2.el6.x86_64 7/7 Installed: httpd24.x86_64 0:1-6.el6 Dependency Installed: httpd24-apr.x86_64 0:1.4.8-2.el6 httpd24-apr-util.x86_64 0:1.5.2-5.el6 httpd24-httpd.x86_64 0:2.4.6-5.el6 httpd24-httpd-tools.x86_64 0:2.4.6-5.el6 httpd24-runtime.x86_64 0:1-6.el6 scl-utils.x86_64 0:20120927-27.el6_6 Complete! |
1 2 3 4 5 6 7 8 |
# ls -l /opt/rh/httpd24/root/etc/httpd total 12 drwxr-xr-x. 2 root root 4096 Oct 7 22:14 conf drwxr-xr-x. 2 root root 4096 Oct 7 22:14 conf.d drwxr-xr-x. 2 root root 4096 Oct 7 22:14 conf.modules.d lrwxrwxrwx. 1 root root 34 Oct 7 22:14 logs -> /opt/rh/httpd24/root/var/log/httpd lrwxrwxrwx. 1 root root 44 Oct 7 22:14 modules -> /opt/rh/httpd24/root/usr/lib64/httpd/modules lrwxrwxrwx. 1 root root 34 Oct 7 22:14 run -> /opt/rh/httpd24/root/var/run/httpd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# ls -l /opt/rh/httpd24/root/usr/sbin/ -rwxr-xr-x. 1 root root 4283 Sep 25 2013 apachectl -rwxr-xr-x. 1 root root 10264 Sep 25 2013 fcgistarter -rwxr-xr-x. 1 root root 30752 Sep 25 2013 htcacheclean -rwxr-xr-x. 1 root root 499384 Sep 25 2013 httpd -rwxr-xr-x. 1 root root 18456 Sep 25 2013 rotatelogs -r-s--x---. 1 root apache 18448 Sep 25 2013 suexec # /opt/rh/httpd24/root/usr/sbin/httpd -V Server version: Apache/2.4.6 (Red Hat) Server built: Sep 25 2013 05:25:46 Server's Module Magic Number: 20120211:23 Server loaded: APR 1.4.8, APR-UTIL 1.5.2 Compiled using: APR 1.4.8, APR-UTIL 1.5.2 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/opt/rh/httpd24/root/etc/httpd" -D SUEXEC_BIN="/opt/rh/httpd24/root/usr/sbin/suexec" -D DEFAULT_PIDLOG="/opt/rh/httpd24/root/var/run/httpd/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" |
1 2 3 4 5 6 7 |
# ls -l /etc/init.d/httpd* -rwxr-xr-x. 1 root root 3488 Jul 19 00:24 /etc/init.d/httpd -rwxr-xr-x. 1 root root 3608 Sep 25 2013 /etc/init.d/httpd24-httpd # chkconfig --list | grep httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off httpd24-httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
1 2 3 4 5 6 7 8 9 10 |
# cat /etc/logrotate.d/httpd24-httpd /opt/rh/httpd24/root/var/log/httpd/*log { missingok notifempty sharedscripts delaycompress postrotate /sbin/service httpd24-httpd reload > /dev/null 2>/dev/null || true endscript } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# /etc/init.d/httpd24-httpd start Starting httpd: [ OK ] # /etc/init.d/httpd24-httpd status httpd (pid 18394) is running... # ps ax | grep httpd 18394 ? Ss 0:00 /opt/rh/httpd24/root/usr/sbin/httpd 18396 ? S 0:00 /opt/rh/httpd24/root/usr/sbin/httpd 18397 ? S 0:00 /opt/rh/httpd24/root/usr/sbin/httpd 18398 ? S 0:00 /opt/rh/httpd24/root/usr/sbin/httpd 18399 ? S 0:00 /opt/rh/httpd24/root/usr/sbin/httpd 18400 ? S 0:00 /opt/rh/httpd24/root/usr/sbin/httpd 18546 ? S 0:00 /opt/rh/httpd24/root/usr/sbin/httpd # ls -l /opt/rh/httpd24/root/var/log/httpd total 8 -rw-r--r--. 1 root root 338 Oct 7 22:20 access_log -rw-r--r--. 1 root root 1065 Oct 7 22:20 error_log |
取り敢えず動いているようです。
ソースからコンパイルすると保守が大変ですがyumだと保守が楽なので有り難いです。