2013年5月23日木曜日

apacheのインストール

お仕事で、apacheでwebdavを実装することになったので、せっかくなので記録を残しつつ。

1.apache実行ユーザの作成

# sudo su -
# useradd -s /sbin/nologin apache
# passwd apache

2.ツールのインストール

# yum install make
# yum install gcc

3.apacheのモジュール入手&展開

# cd /usr/local/src/
# wget http://ftp.kddilabs.jp/infosystems/apache//httpd/httpd-2.4.4.tar.gz
# tar xvfz httpd-2.4.4.tar.gz

4.apacheインストール1回目

# cd httpd-2.4.4
# ./configure --enable-dav-fs --enable-dav --enable-mods-shared=most



configure: error: APR not found.  Please read the documentation.

ありゃ。モジュールが足りんかったか。

5.aprモジュールのインストール

# cd srclib/
# wget http://ftp.jaist.ac.jp/pub/apache//apr/apr-1.4.6.tar.gz
# tar xvfz apr-1.4.6.tar.gz
# mv apr-1.4.6 apr
# cd apr
# ./configure
# make
# make install

# wget http://ftp.jaist.ac.jp/pub/apache//apr/apr-util-1.5.2.tar.gz
# tar xvfz apr-util-1.5.2.tar.gz
# mv apr-util-1.5.2 apr-util
# cd apr-util
# ./configure



configure: error: APR could not be located. Please use the --with-apr option.

arpが見つからないってエラー。気を取り直して、

# ./configure --with-apr=/usr/local/apr
# make
# make install

6.apacheインストール2回目

さぁ、再度apacheをインストール。

# cd /usr/local/src/httpd-2.4.4
# ./configure --enable-shared=max --enable-module=all


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


おっとまた足りないものが。

7.pcreのインストール

# cd /usr/local/src/
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
# tar xvfz pcre-8.31.tar.gz
# cd pcre-8.31
# ./configure
# make


libtool: compile: unrecognized option `-DHAVE_CONFIG_H'
libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] エラー 1
make[1]: ディレクトリ `/usr/local/src/pcre-8.31' から出ます
make: *** [all] エラー 2

ググると、c++が必要とのこと。

# yum install gcc-c++
# make

おっうまくいった。

# make install

無事終了。

8.apacheインストール3回目(3度目の正直)

# cd httpd-2.4.4
# ./configure --enable-dav-fs --enable-dav --enable-mods-shared=most
# make
# make install


成功!

9.その他の準備&起動テスト

hostnameにFQDN(svr2.hayachi617.com)をつけないとapache起動時に怒られるので、

# vi /etc/hosts
>>
127.0.0.1   svr2.hayachi617.com localhost
<<

に追記し、さらに、

# vi /etc/sysconfig/network
>>
HOSTNAME=srv2.hayachi617.com
<<

で完了。サーバを再起動。次にちょっとapacheの設定を変更する

# vi /usr/local/apache2/conf/httpd.conf
>>

User apache

Group apache

ServerName srv2.hayachi617.com:80
<<

# cd /usr/local/apache2/bin
# ./apachectl start

ブラウザからアクセスしてみると、「It works!」と表示された。ようやく終わったと思ったら・・

# ./apachectl status
./apachectl: line 95: lynx: コマンドが見つかりません

だと。

# yum install lynx



The requested URL /server-status was not found on this server.

まだか。ちょっと疲れたので、また次回・・

0 件のコメント:

コメントを投稿