Apache2.0.63インストール方法 on CentOS5.1
Apache2.0の最新版をCentOS5の最新版にインストールする機会があったのでメモします。
以前の自分エントリ(Apache2のインストール方法 on CentOS4.4(ソースから2.0.59))を参考にインストールしてみました。
まずはApacheが既にパッケージとして入っていないかチェック。入っていたら削除しておく
#rpm -qa | grep http httpd-2.2.3-11.el5.centos system-config-httpd-1.3.3.1-1.el5 #rpm -e system-config-httpd #rpm -e httpd
ソースをダウンロード
Apacheのサイトはこちら
Download - The Apache HTTP Server Project
http://httpd.apache.org/download.cgi
2.0.63のソースを落としてきます。
#cd /usr/local/src #wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.0.63.tar.gz
解凍
#tar xvfz httpd-2.0.63.tar.gz
解凍先へ移動
#cd httpd-2.0.63
自動起動の設定
#chkconfig --add httpd
httpd.confの設定
とりあえずServerNameの設定だけしておきます。
#vi /usr/local/apache2/conf/httpd.conf
ServerNameがコメントになっているので有効化して適当に名前をつけます。
ServerName xxx.xxx.xxx.xxx
Apacheの起動
#/etc/rc.d/init.d/httpd start
インストールされたことをブラウザで確認
Apacheのデフォルトページが見えない場合、WWW(HTTP)がファイアウォールにブロックされている可能性があるので、以下のコマンドから設定画面を出して設定を変更します。
system-config-securitylevel-tui
何かページを作ってみる
#vi /usr/local/apache2/htdocs/hello.html
hello.htmlの内容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <title>Message</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript"> // <![CDATA[ // ]]> </script> </head> <body> <p> Hello world!! </p> </body> </html>
ブラウザで http://xxx.xxx.xxx.xxx/hello.html にアクセスし、ページが見れればOKです。