読者です 読者をやめる 読者になる 読者になる

【Apache】CentOS6.5にApache2.4をインストールする

apahce

CentOSはデスクトップでインストールしたもの。
それに対してApache2.4系をインストールする。

2.2系と2.4系は迷ったのだけど、これからを考えるなら2.4だろう!!

まずは必要なソースのダウンロード

wget http://ftp.meisei-u.ac.jp/mirror/apache/dist//httpd/httpd-2.4.10.tar.gz
wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/apr/apr-1.5.1.tar.gz
wget http://ftp.jaist.ac.jp/pub/apache/apr/apr-util-1.5.4.tar.gz

APRとAPR-utilはOSや機種などの環境違いの動作や仕様を吸収してくれるライブラリ。

tar -xvzf apr-1.5.1.tar.gz
cd apr-1.5.1
./configure --prefix=/usr/local/apr-1.5.1

上記でコンパイルするとエラーとなった。
内容は以下の通り。

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Configuring APR library
Platform: x86_64-unknown-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.5.1
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/var/tmp/apr-1.5.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

コンパイラがないとのこと。
確かに入れた記憶はない。

事前準備が必要なものは以下に纏めておく。

 yum -y install gcc


再度コンパイルからインストールまで

./configure --prefix=/usr/local/apr-1.5.1
make
make test
make install

これで APRは完了。

続けてAPR-utilをインストールする

tar -xvzf apr-util-1.5.4.tar.gz 
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util/apr-util-1.5.4 --with-apr=/usr/local/apr-1.5.1
make
make test
make install

APR-utilも完了。

Apacheの本体をインストールする。

tar -xvzf httpd-2.4.10.tar.gz 
cd apr-util-1.5.4
./configure --prefix=/usr/local/apache2.4.10 --with-apr=/usr/local/apr-1.5.1 --with-apr-util=/usr/local/apr-util/apr-util-1.5.4 --enable-so --enable-headers --enable-ssl --enable-deflate --enable-logio


オプションは、APRとAPR-utilに加えて、
他のモジュールを後から追加できるように

    • enable-soオプションの追加

httpヘッダーのコントロールを有効にするために

    • enable-headersオプションの追加

SSL/TLSのサポートを有効にするために
--enable-sslオプション追加

コンテンツの圧縮用に

    • enable-deflateを追加

実際の送信転送量、受信転送量を access.logへ記録する

    • enable-logioを追加


早速エラーとなった

checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org

PCREがないとのこと。
PCREはPerlで使われる、正規表現処理を実装したライブラリ。

yum -y install pcre-devel

上記で再度コンパイルすると再びエラー

 configure: error: mod_deflate has been requested but can not be built due to prerequisite failures


deflateを有効にするために必要なソフトがないとのこと。

yum -y install zlib-devel

再びエラーとなった。

configure: WARNING: OpenSSL version is too old
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

OpenSSLが古いとのこと。というかない?

yum -y install openssl-devel

で、再々コンパイルをし、インストール

make
make install

これで、無事にインストール完了。
次回はApacheの設定と起動についてもおさらい。

Welcome! - The Apache Portable Runtime Project


Apache httpd 2.4 をソースからインストールする手順 (CentOS/RedHat) | WEB ARCH LABO


【Apache】エラー対処方法 - ぱそ子のめも


apache 2.4系からは | zhenwu`no - 楽天ブログ