# rpm -qa | grep -i apache apache-devel-1.3.12-2LL2 apache-manual-1.3.12-2LL2 apache-1.3.12-2LL2 # rpm -e apache-devel-1.3.12-2LL2 # rpm -e apache-manual-1.3.12-2LL2 # rpm -e apache-1.3.12-2LL2 /var/log/httpd を削除できません - ディレクトリが空でありません /home/httpd/html を削除できません - ディレクトリが空でありません /home/httpd/cgi-bin を削除できません - ディレクトリが空でありません /home/httpd を削除できません - ディレクトリが空でありません /etc/httpd/conf を削除できません - ディレクトリが空でありません |
(*) 削除できなかったディレクトリは気色悪いので自分で消しておきました。
# cd /usr/local/src # tar xzvf apache_1.3.20.tar.gz : (解凍..) # cd apache_1.3.20 # OPTIM="-O2" ./configure --enable-module=so # make # make install |
で、うまくインストールできたら最後に以下のメッセージが現れます。
+--------------------------------------------------------+ | You now have successfully built and installed the | | Apache 1.3 HTTP server. To verify that Apache actually | | works correctly you now should first check the | | (initially created or preserved) configuration files | | | | /usr/local/apache/conf/httpd.conf | | | and then you should be able to immediately fire up | | Apache the first time by running: | | | | /usr/local/apache/bin/apachectl start | | | Thanks for using Apache. The Apache Group | | http://www.apache.org/ | +--------------------------------------------------------+ |
/usr/local/apache/bin に実行ファイルがインストールされています。
ServerName www.hogehoge.bogus |
# /usr/local/apache/bin/apachectl start |
で起動します。下のメッセージが表示されれば正常に起動しています。
/usr/local/apache/bin/apachectl start: httpd started |
# cd /home/foo/lib # /usr/local/apache/bin/htpasswd -c ./passwd foo New password: XXXXXX Re-type new password: XXXXXX Adding password for user foo # /usr/local/apache/bin/htpasswd ./passwd bar New password: XXXXXX Re-type new password: XXXXXX Adding password for user bar |
この /home/foo/lib/passwd を使って認証が通って、 はじめてアクセスさせたいディレクトリがあれば、httpd.conf に追加します。
335行目辺りに(どこでもいいんですが<Directory>がある辺りがよいと..) 以下を挿入します。
<Directory "/usr/local/apache/htdocs/info"> AllowOverride AuthConfig AuthType Basic AuthName Admin AuthUserFile /home/foo/lib/passwd Order deny,allow deny from all allow from .docomo.ne.jp 192.168.1.0/24 127.0.0.1 require valid-user </Directory> |
# /usr/local/apache/bin/apachectl restart |
#!/bin/sh # # Startup script for the Apache Web Server # # chkconfig: 345 85 15 # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # See how we were called. case "$1" in start) echo -n "Starting httpd: " /usr/local/apache/bin/apachectl start echo touch /var/lock/subsys/httpd ;; stop) echo -n "Shutting down httpd: " /usr/local/apache/bin/apachectl stop echo rm -f /var/lock/subsys/httpd rm -f /var/run/httpd.pid ;; status) status httpd ;; restart) /usr/local/apache/bin/apachectl restart echo ;; reload) echo -n "Reloading httpd: " killproc httpd -HUP echo ;; *) echo "Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit 0 |
実行属性を付与しておきます
# chmod +x httpd |
chkconfig で自動設定します.
# chkconfig --add httpd |
これでOKです。
# cd /usr/local # mv pgsql pgsql-6.5.3 |
# adduser postgres |
パスワードも設定
# passwd postgres |
# cd /usr/local # mkdir pgsql # chown postgres:postgres pgsql |
# cd /usr/local/src # mkdir postgresql-7.1.3 # chown postgres:postgres postgresql-7.1.3 |
# su - postgres # # cd /usr/local/src # tar xzvf postgresql-7.1.3.tar.gz : (展開) |
ビルドします。
7.1からは postgresql-7.1.X/src に移動する必要がなく、postgresql-7.1.X
の直下で、./configure を実行します。マニュアルも同時にインストールされる
ようです。
# cd postgresql-7.1.3 # ./configure --enable-multibyte=EUC_JP # make |
regression test を行います
# make check |
ようやくインストールです。
# make install |
完了.
# cd /usr/local/pgsql # mkdif data |
/usr/local/pgsql/data がデータベースクラスタとなります。 環境変数PGDATAに設定します(以下で説明)。
PATH="$PATH":/usr/local/pgsql/bin export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export MANPATH="$MANPATH":$POSTGRES_HOME/man export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB" |
編集したら以下で設定を更新しておきます。
# source ~/.bashrc |
# initdb |
いろいろメッセージがでてきますが、最後に以下のような表示が出ればOKです。
Success. You can now start the database server using: /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data or /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start |
# pg_ctl start |
デーモンプロセスです。
ちょっとテストでデータベースを作成して、削除してみます。
$ createdb test CREATE DATABASE $ dropdb test DROP DATABASE |
うん、何かよさそう。
/usr/local/src/postgresql-7.1.3/contrib/start-scripts/linux
rootで、 このファイルを postgres の名前で /etc/rc.d/init.d の下にコピーします。 ちょっと編集します。以下を、2行目に追加して下さい。
# chkconfig: 345 85 15 # description: PostgreSQL postmaster |
上の行の 345 はランレベルです。85は start priority, 15 は stop priority です。ご自分の環境に合わせて設定して下さい。 実行属性を与えます。
# chmod +x postgres |
chkconfig で起動設定します。
# chkconfig --add postgres |
リブートして確認してみましょう。
# ps -aux | grep postgres |
当然、ユーザー postgres で行います。 ユーザー`foo' を登録。
$ createuser foo Shall the new user be allowed to create databases? (y/n) y Shall the new user be allowed to create more new users? (y/n) n CREATE USER |
データベースを作成する権限を与えます。他に追加するユーザーがない場合は、 2つ目の質問で n と答えます。
次に、データーベースを作成する権限がないユーザー`bar' を作成します。
$ createuser bar Shall the new user be allowed to create databases? (y/n) n Shall the new user be allowed to create more new users? (y/n) n CREATE USER |
ついでに Web+DBの時に必要な Apache 用の nobody ユーザー も作成しておきます。
# createuser nobody |
nobody にはデータベース作成の権限は付与しない。
# cd /usr/local/src # tar xzvf php-4.0.6.tar.gz : (解凍..) # cd php-4.0.6 |
ここで、日本語正規表現用のソースを展開.
/usr/local/src/php-4.0.6/ext に php4_mbregex-1.2.1.tar.gz があるものと
します。
# cd ext # tar xzvf php4_mbregex-1.2.1.tar.gz mbregex/ mbregex/config.m4 mbregex/Makefile.in mbregex/mbregex.c mbregex/php_mbregex.h mbregex/php_mbregex.c mbregex/mbregex.h mbregex/README.ja mbregex/php_mbregex_globals.h mbregex/config.h |
PHP本体をコンパルします。
configure で指定するオプション (5つ)
# cd /usr/local/src/php-4.0.6 # ./buildconf buildconf: checking installation... buildconf: autoconf version 2.13 (ok) buildconf: automake version 1.4 (ok) buildconf: libtool version 1.3.4 (ok) # ./configure --with-apxs=/usr/local/apache/bin/apxs \ --with-pgsql \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-mbregex # make # make install |
# cp php.ini-dist /usr/local/lib/php.ini |
これを編集します。
output_handler = mb_output_handler |
[mbstring] mbstring.detect_order = AUTO mbstring.internal_encoding = EUC-JP mbstring.http_output = SJIS mbstring.http_input = AUTO |
LoadFile /usr/local/pgsql/lib/libpq.so |
# /usr/local/apache/bin/apachectl restart /usr/local/apache/bin/apachectl restart: httpd restarted |
<?phpinfo();?> |
OK だぜ。
表示された表の項目で PostgreSQL があれば PostgreSQLとの連携もOKだ。
by masu
e-mail: massun.masumoto@nifty.ne.jp
URL : http://member.nifty.ne.jp/~masumoto/