[ Home | Draw | Photo | MIDI | Library | BBS | Link ] - [ Twitter  Tumblr  FriendFeed  nicovideo  hatena diary  hatena bookmark ]

Home
Library
Special -
AirH
RADEON 9600XT
Review -
Radeon 9000
Linux Install -
Apache
PHP4
PostgreSQL
ProFTPD
Tomcat
Squid
2ch log


image - PostgreSQL 7.3.1 -

PostgreSQL インストールメモ

[ 関連サイト ]

日本 PostgreSQL ユーザ会
http://www.jp.postgresql.org/

PostgreSQL7.1でのJDBCのビルド方法
http://osb.sra.co.jp/PostgreSQL/7.1/jdbc-build.html


[ インストール済みパッケージの削除 ]

rpmコマンドで確認して古いものがあれば削除
# rpm -qa | grep postgresql
postgresql-7.2.2-1
postgresql-docs-7.2.2-1
postgresql-libs-7.2.2-1
postgresql-perl-7.2.2-1
postgresql-tcl-7.2.2-1
postgresql-contrib-7.2.2-1
postgresql-odbc-7.2.2-1
postgresql-tk-7.2.2-1
postgresql-jdbc-7.2.2-1
postgresql-server-7.2.2-1
postgresql-python-7.2.2-1
postgresql-devel-7.2.2-1

# rpm -qa | grep postgresql | xargs rpm -e --nodeps

# rpm -qa | grep postgresql

[ PostgreSQL 管理ユーザ追加 ]

PostgreSQL 管理用のユーザを追加します
# useradd postgres

[ PostgreSQL インストール ]

# tar xvzf postgresql-7.3.1.tar.gz
# chown postgres.postgres postgresql-7.3.1 -R

# mkdir /usr/local/pgsql
# chown postgres.postgres /usr/local/pgsql/

# cd postgresql-7.3.1
# su postgres

$ ./configure

$ make
$ make install

# ドキュメントをインストール

$ cd doc
$ make install

[ 環境変数設定 ]

/home/postgres/.bash_profile を編集して、環境変数を設定します
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 ~/.bash_profile

[ データベース初期化 ]

環境変数を設定した後、一度だけ行います
$ initdb --encoding=EUC_JP

[ 自動起動設定 ]

/etc/rc.d/rc.local を編集します
POSTGRESDIR=/usr/local/pgsql
if [ -x $POSTGRESDIR/bin/postmaster -a -d $POSTGRESDIR/data ]; then
    rm -f /tmp/.s.PGSQL.5432
    su - postgres -c "postmaster -S -i"
    echo -n 'postmaster '
fi

[ 回帰テスト ]

postmaster が動作している状態で、展開したソースディレクトリへ移ります
$ cd postgresql-7.3.1/src/test/regress/
$ make all runtest

============== dropping database "regression"         ==============
ERROR:  DROP DATABASE: database "regression" does not exist
dropdb: database removal failed
============== creating database "regression"         ==============
CREATE DATABASE
ALTER DATABASE
============== dropping regression test user accounts ==============
============== installing PL/pgSQL                    ==============
============== running regression test queries        ==============
test boolean              ... ok
test char                 ... ok
test name                 ... ok
test varchar              ... ok
test text                 ... ok
test int2                 ... ok
test int4                 ... ok
test int8                 ... ok
test oid                  ... ok
test float4               ... ok
test float8               ... ok
test bit                  ... ok
test numeric              ... ok
test strings              ... ok
test numerology           ... ok
test point                ... ok
test lseg                 ... ok
test box                  ... ok
test path                 ... ok
test polygon              ... ok
test circle               ... ok
test date                 ... ok
test time                 ... ok
test timetz               ... ok
test timestamp            ... ok
test timestamptz          ... ok
test interval             ... ok
test abstime              ... ok
test reltime              ... ok
test tinterval            ... ok
test inet                 ... ok
test comments             ... ok
test oidjoins             ... ok
test type_sanity          ... ok
test opr_sanity           ... ok
test geometry             ... ok
test horology             ... ok
test insert               ... ok
test create_function_1    ... ok
test create_type          ... ok
test create_table         ... ok
test create_function_2    ... ok
test copy                 ... ok
test constraints          ... ok
test triggers             ... ok
test create_misc          ... ok
test create_aggregate     ... ok
test create_operator      ... ok
test create_index         ... ok
test inherit              ... ok
test vacuum               ... ok
test create_view          ... ok
test sanity_check         ... ok
test errors               ... ok
test select               ... ok
test select_into          ... ok
test select_distinct      ... ok
test select_distinct_on   ... ok
test select_implicit      ... ok
test select_having        ... ok
test subselect            ... ok
test union                ... ok
test case                 ... ok
test join                 ... ok
test aggregates           ... ok
test transactions         ... ok
test random               ... ok
test portals              ... ok
test arrays               ... ok
test btree_index          ... ok
test hash_index           ... ok
test privileges           ... ok
test misc                 ... ok
test select_views         ... ok
test portals_p2           ... ok
test rules                ... ok
test foreign_key          ... ok
test cluster              ... ok
test limit                ... ok
test plpgsql              ... ok
test copy2                ... ok
test temp                 ... ok
test domain               ... ok
test rangefuncs           ... ok
test prepare              ... ok
test without_oid          ... ok
test conversion           ... ok
test truncate             ... ok
test alter_table          ... ok

======================
 All 89 tests passed.
======================

[ JDBCドライバ作成 ]

JavaからPostgreSQLにアクセスするためのJDBCドライバを作成します JDK と Ant をインストールした後、postgres ユーザの環境変数に JAVA_HOME と ANT_HOME を追加します
export ANT_HOME=/usr/local/jakarta-ant-1.4.1
export JAVA_HOME=/usr/local/jdk1.3.1
...
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH:/usr/local/pgsql/bin
ソースを置いたディレクトリで --with-java オプション付きで configure を実行
$ cd postgresql-7.3.1

$ ./configure --with-java

$ cd src/interfaces/jdbc/

$ make
$ su

# cp jars/postgresql.jar /usr/local/jdk1.3.1/jre/lib/ext/