ここでは、Apache HTTPサーバを、
/usr/local/apache/以下にインストールする。
Apache HTTPサーバのインストール方法については、Apacheの公式ウェブサイトの『コンパイルとインストール』にも書かれているのでまずはそちらも参考にするとよい。
現時点での最新版はApache HTTPサーバ・バージョン2.2.17。 システムはVine Linux 5.1。 Mac OS Xを含む他のUNIX系のOSにも同じ方法でインストールできると思う。
Apache HTTPサーバのコンパイルには、APR(Apache Portable Runtime)とAPR-Util(Apache Portable Runtime Utility Library)が必要になる。もしインストールしていなければ次のリンク先を読んでインストールしておく。
Apache HTTPサーバの実行ユーザーはrootではなくて、新規に作成するapacheというユーザーにしたいので、ユーザーの作成を行う。パスワードも設定しておく。
# useradd apache # passwd apacheソース取得、コンパイルからインストールまでをapacheユーザーで行う。
Apache HTTPサーバのウェブサイトからソースを取得する。ソースの解凍からインストールまでは次の通り。
$ tar zxvf httpd-2.2.17.tar.gz $ cd httpd-2.2.17/ $ ./configure --prefix=/usr/local/apache \ > --with-apr=/usr/local/apache \ > --with-apr-util=/usr/local/apache \ > --enable-soここで--enable-soは後にモジュールをインストールするのに必要なのでつけている。
そしてコンパイルとインストールは次の通り。
$ make $ su # mkdir /usr/local/apache # chown apache:apache /usr/local/apche # exit $ make install
configureのオプションでつけたenable-soが反映されているか確認する。
$ /usr/local/apache/bin/httpd -l ... ... mod_so.c ...mod_so.cが現れることを確認。
次にhttpdの実行ユーザーをapacheにする。/usr/local/apache/conf/httpd.confを開いて、次の様に修正する。
User apache Group apache
httpdを起動するためには、rootでapachectlを実行する。
# /usr/local/apache/bin/apachectl start
Vine Linux 5.1で自動起動する方法を紹介する。 コンパイルに用いたソースファイルの中にあるbuild/rpm/httpd.initを起動用のスクリプトとして用いる。ただし、中身が古いようなのでサーバーの設定に合わせて書き換える必要がある。httpd.initは/etc/init.d/にhttpdとリネームして配置する。
# cp build/rpm/httpd.init /etc/init.d/httpd
書き換えるのは次の箇所。
--- build/rpm/httpd.init 2009-12-01 07:57:41.000000000 +0900
+++ /etc/init.d/httpd 2011-04-12 10:57:42.000000000 +0900
@@ -53,23 +53,23 @@
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
-httpd=${HTTPD-/usr/sbin/httpd}
+httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/log/httpd/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
-# check for 1.3 configuration
-check13 () {
- CONFFILE=/etc/httpd/conf/httpd.conf
+# check for 2.2 configuration
+check22 () {
+ CONFFILE=/usr/local/apache/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
- echo 1>&2 " Apache 1.3 configuration directives found"
+ echo 1>&2 " Apache 2.2 configuration directives found"
echo 1>&2 " please read @docdir@/migration.html"
- failure "Apache 1.3 config directives test"
+ failure "Apache 2.2 config directives test"
echo
exit 1
fi
起動ファイルの修正を行った後、起動項目に登録する。
# chkconfig --add httpd
ランレベル3, 5の時に起動するように設定する。
# chkconfig --levels 35 httpd on
設定を確認する。
# chkconfig --list httpd
次にPostgreSQLをインストールしよう。