Apacheのコンパイルとインストール

UNIXサーバ構築 OnTheVMware
CentOS上でのサーバ構築について解説

HOME > CentOS > ApacheによるWebサーバ構築 >

Apacheのコンパイルとインストール

Apacheのコンパイルとインストール


スポンサードリンク


本項ではApacheのコンパイルとインストールの手順について解説します。

1. Apache作業用ディレクトリにダウンロードしてきたファイルがあることを確認

[root@localhost APACHE]# ls -l
合計 5772
-rw-r--r-- 1 root root 5896358 7月 12 2008 httpd-2.0.63.tar.gz



2. tarボールからソースファイルを展開します。

[root@localhost APACHE]# tar zxvf httpd-2.0.63.tar.gz
httpd-2.0.63/
httpd-2.0.63/.deps
httpd-2.0.63/.gdbinit
httpd-2.0.63/ABOUT_APACHE
httpd-2.0.63/acconfig.h
httpd-2.0.63/acinclude.m4
httpd-2.0.63/Apache.dsp
httpd-2.0.63/Apache.dsw
httpd-2.0.63/apachenw.mcp.zip
httpd-2.0.63/build/
httpd-2.0.63/build/apr_common.m4
httpd-2.0.63/build/binbuild.sh
httpd-2.0.63/build/bsd_makefile
httpd-2.0.63/build/build-modules-c.awk




3. 新たしくディレクトリが作成されているので、コンパイルの前に新規に作成されたディレクトリへ移動します。

[root@localhost APACHE]# ls -l
合計 5776
drwxr-xr-x 11 501 games 4096 1月 11 01:49 httpd-2.0.63
-rw-r--r-- 1 root root 5896358 7月 12 2008 httpd-2.0.63.tar.gz
[root@localhost APACHE]#
cd httpd-2.0.63
[root@localhost httpd-2.0.63]#



4. この段階で、モジュールを有効にしたり、インストールディレクトリを指定したりカスタマイズを行います。私は基本的に追加のソフトはoptディレクトリにインストールするのでprefixオプションに/optを指定してMakefileを作成します。

[[root@localhost httpd-2.0.63]# ./configure --prefix=/opt/httpd
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu

Configuring Apache Portable Runtime library ...


※「./configure --help」と入力すると、この「configure」というのが設定を行うためのコマンドで、表示されたメッセージは、設定できる内容についての説明書きが表示されます。

ApacheのDSO機能について解説しているのでコンパイル前に一読していただくと参考になるとおもります。



5. Makefileが作成されたことを確認したら、続いてビルドを行います。ビルドとは、コンパイルやライブラリのリンクなどを行ない、最終的な実行可能ファイルを作成することをいいます。

[root@cent01 httpd-2.0.63]# make
Making all in srclib
make[1]: Entering directory `/root/Apache/httpd-2.0.63/srclib'
Making all in apr
make[2]: Entering directory `/root/Apache/httpd-2.0.63/srclib/apr'
Making all in strings
make[3]: Entering directory `/root/Apache/httpd-2.0.63/srclib/apr/strings'
make[4]: Entering directory `/root/Apache/httpd-2.0.63/srclib/apr/strings'
/bin/sh /root/Apache/httpd-2.0.63/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I../include -I../include/arch/unix -c apr_cpystrn.c && touch apr_cpystrn.lo




6. 最後にインストールを実行します。

[root@cent01 httpd-2.0.63]# make install
Making install in srclib
make[1]: Entering directory `/root/Apache/httpd-2.0.63/srclib'
Making install in apr
make[2]: Entering directory `/root/Apache/httpd-2.0.63/srclib/apr'
sed 's,^\(location=\).*$,\1installed,' < apr-config > apr-config.out
sed 's,^\(apr_build.*=\).*$,\1/opt/build,' < build/apr_rules.mk > build/apr_rules.out
Making all in strings
make[3]: Entering directory `/root/Apache/httpd-2.0.63/srclib/apr/strings'
make[4]: Entering directory `/root/Apache/httpd-2.0.63/srclib/apr/strings'




Apache動作確認に進む

Apacheのコンパイルとインストール

Apache動作確認

Apache起動スクリプト作成

Apache初期設定

Apacheディレクティブ一覧

Apacheモジュール一覧

Apache .htaccess設定例

Apache VirtualHost設定




スポンサードリンク



スポンサードリンク


 HOME / 免責事項 / サイトマップ /  問い合わせ
Copyright (C) 2008  UNIXサーバ構築 OnTheVMware  All rights reserved