# rpm -qa | grep postgres | xargs rpm -e # rpm -qa | grep httpd | xargs rpm -e # rpm -qa | grep php | xargs rpm -e
¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×¤¹¤ë¾ì¹ç¤Ïpg_dump¤·¤Æpg_ctl stop¤·¤Æ¤ª¤¤Þ¤·¤ç¤¦
postgres ¥æ¡¼¥¶¡¼¤ÎºîÀ®
# /usr/sbin/useradd -d /usr/local/pgsql postgres # passwd postgres
ºî¶È¥Ç¥£¥ì¥¯¥È¥êºîÀ®
# mkdir -p /usr/local/src/postgresql-7.4.3 # chown postgres /usr/local/src/postgresql-7.4.3 # mkdir -p /usr/local/pgsql # chown postgres /usr/local/pgsql
¥½¡¼¥¹¼èÆÀ http://www.postgresql.jp/
# su postgres $ tar xvzf postgresql-7.4.3.tar.gz $ cd postgresql-7.4.3 $ ./configure
7.3°Ê¹ß¤Ï¥Þ¥ë¥Á¥Ð¥¤¥È¥µ¥Ý¡¼¥È¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç͸ú¤Ë¤Ê¤ë
¥í¥°¤ò¼è¤ë¤È¤¤Ï --enable-syslog ODBCÀܳ¤¹¤ë¾ì¹ç¤Ï --enable-odbc --with-unixodbc
JDBC¥É¥é¥¤¥Ð¤ò¥Ó¥ë¥É¤¹¤ë¾ì¹ç¤Ï --with-java ¤Ç¤âANT1.5°Ê¾å¤¬¤¤¤ë¤é¤·¤¤
$ make all $ make check $ make install
¥Ð¡¼¥¸¥ç¥ó¤ò¾å¤²¤ë¤È¥¨¥é¡¼¤¬½Ð¤Æmake check¤¬¤Ç¤¤Ê¤¤¤³¤È¤¬¤¢¤ë ¤³¤ó¤Ê´¶¤¸¢
============== removing existing temp installation ============== ============== creating temporary installation ============== ============== initializing database system ============== ============== starting postmaster ============== running on port 65432 with pid 4246 ============== creating database "regression" ============== /usr/local/src/postgresql- 7.4.2/src/test/regress/./tmp_check/install//usr/local/pgsql/bin/createdb:
relocation error: /usr/local/src/postgresql-7.4.2/src/test/regress/./tmp_check/install//usr/local/pg sql/bin/createdb: undefined symbol: get_progname
pg_regress: createdb failed make[2]: *** [check] ¥¨¥é¡¼ 2 make[2]: ½Ð¤Þ¤¹ ¥Ç¥£¥ì¥¯¥È¥ê `/usr/local/src/postgresql-7.4.2/src/test/regress' make[1]: *** [check] ¥¨¥é¡¼ 2 make[1]: ½Ð¤Þ¤¹ ¥Ç¥£¥ì¥¯¥È¥ê `/usr/local/src/postgresql-7.4.2/src/test' make: *** [check] ¥¨¥é¡¼ 2
¤³¤ì¤Ï¸Å¤¤libpq.so¤¬»Ä¤Ã¤Æ¤¤¤ë¤«¤é¤é¤·¤¤
# rm -fr /usr/local/pgsql/lib
¤Ê¤É¤È¤·¤Æºï½ü¤·¤Á¤ã¤¤¤Þ¤·¤ç¤¦
Ê̤˥¤¥ó¥¹¥È¡¼¥ëɬÍפϤ¢¤ê¤Þ¤»¤ó bison¤¬É¬ÍפǤ¹
$ su postgres $ cd /usr/local/src/postgresql-7.4.3/contrib $ gmake all $ gmake install ¢¬ ¥Ñ¥¹¤ÎÀßÄê ¢÷ postgres¤ÈPostgreSQL¤ò»ÈÍѤ¹¤ë¥æ¡¼¥¶¡¼Á´¤Æ¤Î.bashrc¤Ë°Ê²¼¤òÄɲÃ
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 --encoding=EUC_JP --no-locale postmaster¤Îµ¯Æ°
$ pg_ctl -w start nobody¥æ¡¼¥¶¡¼¤ÎÄɲÃ
$ createuser nobody $ n $ n /etc/ld.so.conf¤Ë°Ê²¼¤Î°ì¹Ô¤òÄɲÃ
/usr/local/pgsql/lib
# /sbin/ldconfig ¼«Æ°µ¯Æ°¤ÎÀßÄê
# cp /usr/local/src/postgresql-7.4.3/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
# chmod 755 /etc/rc.d/init.d/postgresql
# /sbin/chkconfig --add postgresql ¢¬ Pg.pm¤Î¥¤¥ó¥¹¥È¡¼¥ë ¢÷ Pg.pm¤Ï7.3¤«¤éÊÌ´ÉÍý¤Ë¤Ê¤Ã¤¿¤½¤¦¤Ê Perl¤«¤éPg.pm¤ÇÀܳ¤¹¤ë¾ì¹ç¤Ï°Ê²¼¤ò¼Â¹Ô
http://gborg.postgresql.org/project/pgperl/download/download.php
pgperl-2.0.2.tar.gz
# tar xvzf pgperl-2.0.2.tar.gz
# cd Pg-2.0.2
# POSTGRES_HOME=/usr/local/pgsql
# export POSTGRES_HOME
# perl Makefile.PL
# make
# make test
# make install ¢¬ syslog´ØÏ¢ÀßÄê ¢÷ »²¹Í¥µ¥¤¥È
$ vi /usr/local/pgsql/data/postgresql.conf
log_connections = true # Àܳ¥í¥°¤ò»Ä¤¹ log_statement = true # Á´¤Æ¤ÎSQLʸ¤òµÏ¿ debug_print_parse = true # ¥Ñ¡¼¥¹¥Ä¥ê¡¼¤ò½ÐÎϤ·¤Þ¤¹ debug_print_rewritten = true # ½ñ¤´¹¤¨¸å¤Î¥Ñ¡¼¥¹¥Ä¥ê¡¼¤ò½ÐÎϤ·¤Þ¤¹ debug_print_plan = ture # Ìä¹ç¤»¥×¥é¥ó¤ò½ÐÎϤ·¤Þ¤¹ syslog = 2 # ½ÐÎϤòÀ©¸æ¤·¤Þ¤¹(0:½ÐÎϤʤ· 1:syslog¤Èstdout¤Ë½ÐÎÏ 2:syslog¤Î¤ß¤Ë½ÐÎÏ) syslog_facility = 'LOCAL0'
$ pg_ctl stop $ pg_ctl -w start PostgreSQL¤Î¥í¥°¥Õ¥¡¥¤¥ë¤ÏÊ̤ËÅǤ½Ð¤¹¤è¤¦¤ËÀßÄê
$su
# vi /etc/syslog.conf
local0.* /var/log/postgres # ¾¤Ëlocal0¤ò»È¤Ã¤Æ¤¤¤Ê¤¤¤«Ãí°Õ
# ps ax | grep syslog
# kill -HUP Ä´¤Ù¤¿syslogd¤ÎPID ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥óÀßÄê
# vi /etc/logrotate.d/postgres
"/var/log/postgres" {
rotate 4 weekly sharedscripts postrotate /usr/bin/killall -HUP syslogd endscript
} ¢¬ Apache¤Î¥¤¥ó¥¹¥È¡¼¥ë ¢÷ http://www.apache.or.jp/
# tar xvzf apache_1.3.31.tar.gz
# cd apache_1.3.31
# OPTIM="-O2" ./configure --enable-module=so --enable-module=rewrite
# make
# make install Options
FollowSymLinks? ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ò͸ú Indexes ¥Ç¥£¥ì¥¯¥È¥êÆâ´Ý¸«¤¨ Includes SSI͸ú ExecCGI CGI͸ú MultiViews? ¥Ö¥é¥¦¥¶¤òȽÄê(?)
AllowOverride?
AuthConfig? ǧ¾Ú͸ú FileInfo? ¥É¥¥å¥á¥ó¥È¥¿¥¤¥×¤Î¥Ç¥£¥ì¥¯¥Ç¥£¥Ö»ÈÍѵö²Ä Indexes ¥Ç¥£¥ì¥¯¥È¥ê¥¤¥ó¥Ç¥Ã¥¯¥¹À©¸æ Limit ¥Û¥¹¥È¤Ø¤Î¥¢¥¯¥»¥¹À©¸æ
Apache¤Î¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨¤µ¤»¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï httpd.conf ¤Ë¤ª¤¤¤Æ
ServerSignature Off ServerTokens ProductOnly # ¾¤Ëminimal,OS,Full¤¬»ØÄê¤Ç¤¤ë ²èÁü¥Õ¥¡¥¤¥ë¤Ï¥í¥°¤ËµÏ¿¤·¤Ê¤¤¤¿¤á¤Ë¤Ï httpd.conf ¤Ë¤ª¤¤¤Æ
IfModule mod_setenvif.c>
# no add images log SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" no_log
.....
CustomLog /usr/local/apache/logs/access_log combined env=!no_log ¢¬ PHP4¤Î¥¤¥ó¥¹¥È¡¼¥ë ¢÷
# tar xvzf php-4.3.7.tar.gz
# cd php-4.3.7
# ./configure --with-pgsql --with-apxs=/usr/local/apache/bin/apxs --enable-zend-multibyte --enable-mbstring --enable-mbregex
GD¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï¤³¤ó¤Ê´¶¤¸
# ./configure \
php.ini¤ÎÀßÄê
# cp /usr/local/src/php-4.3.7/php.ini-dist /usr/local/lib/php.ini php.ini¤ÎÊÔ½¸
;; ½ÐÎϥХåե¡¥ê¥ó¥°¤ò͸ú¤Ë¤¹¤ë output_buffering = On
;; mb_output_handler¤Ë¤è¤ë½ÐÎÏÊÑ´¹¤ò͸ú¤Ë¤¹¤ë output_handler = mb_output_handler
;; HTTP¥Ø¥Ã¥À charset ¤òÀßÄê default_charset = Shift_JIS
;;ÆüËܸì¼çÂΤǻÈÍÑ mbstring.language = Japanese
;; ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òEUC-JP¤ËÀßÄê mbstring.internal_encoding = EUC-JP
;; HTTPÆþÎÏ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹¤òauto¤ËÀßÄê mbstring.http_input = auto
;; SJIS¤ËÊÑ´¹ mbstring.http_output = SJIS
mbstring.encoding_translation = On¡¡É¬Íס© mbstring.detect_order = auto¡¡É¬Íס©
;; ̵¸ú¤Êʸ»ú¤ò½ÐÎϤ·¤Ê¤¤ mbstring.substitute_character = none;
mbstring.func_overload = 0
;; 4.1.0¤«¤é¿ä¾© register_globals = Off
# make
# make install httpd.conf¤Î½ñ¤´¹¤¨
#AddType application/x-httpd-php .php ¤Î¥³¥á¥ó¥È¤ò¤Ï¤º¤·¤ÆApacheºÆµ¯Æ°
CGIÈǤò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¾ì¹ç(4.3.0°Ê¹ß¤ÏÉÔÍ×)
# make distclean
# ./configure --with-pgsql --enable-track-vars --enable-force-cgi-redirect --enable-mbstring --enable-mbstr-enc-trans
# make
# make install ¤³¤ì¤Ç/usr/local/bin/php ¤Ë¥Ð¥¤¥Ê¥ê¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤ë
¢¬ Apache¼«Æ°µ¯Æ°¤ÎÀßÄê ¢÷ /etc/rc.d/rc.local¤Ë°Ê²¼¤òµ½Ò
if [ -x /usr/local/apache/bin/apachectl ]; then
/usr/local/apache/bin/apachectl start
fi ¢¬ ¥í¥°¤Î¥í¡¼¥Æ¡¼¥·¥ç¥óÀßÄê ¢÷ ¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿¤Þ¤Þ¤Ç¤Ï¥í¥°¥Õ¥¡¥¤¥ë¤¬ÈîÂ礷¤Æ¥Ç¥£¥¹¥¯ÍÆÎ̤ò°µÇ÷¤¹¤ë¤Î¤Çɬ¤ºÀßÄꤷ¤Þ¤·¤ç¤¦ /etc/logrotate.d/apache ¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Æ°Ê²¼¤òµ½Ò
"/usr/local/apache/logs/access_log" "/usr/local/apache/logs/error_log" {
rotate 4 compress # ZIP°µ½Ì¤¹¤ë¾ì¹ç weekly sharedscripts postrotate /usr/local/apache/bin/apachectl restart endscript
}
# /usr/sbin/logrotate -f /etc/logrotate.d/apache ¥³¥Þ¥ó¥É¤Ë¤Æ /usr/local/apache/logs Æâ¤Ë access_log.1 error_log.1 ¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤ì¤ÐOK
$_GET GET¤òÄ̤¸¤ÆÁ÷¿®¤µ¤ì¤¿ÆâÍƤ¬³ÊǼ¤µ¤ì¤Þ¤¹ $_POST POST¤òÄ̤¸¤ÆÁ÷¿®¤µ¤ì¤¿ÆâÍƤ¬³ÊǼ¤µ¤ì¤Þ¤¹ $_COOKIE HTTP¥¯¥Ã¥¡¼¤ÎÆâÍƤ¬³ÊǼ¤µ¤ì¤Þ¤¹ $_SERVER ¥µ¡¼¥ÐÊÑ¿ô¤ÎÆâÍƤ¬³ÊǼ¤µ¤ì¤Þ¤¹(Îã:REMOTE_ADDR) $_ENV ´Ä¶ÊÑ¿ô¤¬³ÊǼ¤µ¤ì¤Þ¤¹ $_REQUEST GET, POST, ¥¯¥Ã¥¡¼¤ÎÆâÍƤ¬³ÊǼ¤µ¤ì¤Þ¤¹ $_SESSION ¥»¥Ã¥·¥ç¥ó¥â¥¸¥å¡¼¥ë¤Ë¤è¤êÅÐÏ¿¤µ¤ì¤¿ÆâÍƤ¬³ÊǼ¤µ¤ì¤Þ¤¹
¢¬ ¥ß¥Ë¥á¥â ¢÷ PostgreSQL7.3¤«¤é¤Ï¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¤Î .pgpass ¤Ë¡¢ ¥Ç¡¼¥¿¥Ù¡¼¥¹¥Û¥¹¥È¤È¥æ¡¼¥¶¥Ñ¥¹¥ï¡¼¥É¤¬µ½Ò¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£ ´Ä¶ÊÑ¿ô PGPASSWORD ¤Ç¤Ï¤Ê¤¯¡¢.pgpass ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£