PostgreSQL 8.1をインストール
http://www.postgresql.org/等でソースアーカイブをダウンロードします。
readline関連で、なぜかconfigureエラーとなってしまいます。readlineオプションを外しました。不便だけど、しょうがないか・・・。
$ tar xvzf postgresql-8.1.0.tar.gz
$ cd postgresql
$ ./configure --with-perl --without-readline
$ make
$ su
Password: password
# make install
ユーザとグループの作成
ユーザpostgresとグループpostgresを作成。パスワードも設定しておきます。
# groupadd postgres
# useradd -g postgres postgres
# passwd postgres
Password: password
データ用のディレクトリ作成
データ保存用のディレクトリを作成し、オーナーとグループを設定。
# mkdir /usr/local/pgsql/data
# chown -R postgres /usr/local/pgsql/data
# chgrp -R postgres /usr/local/pgsql/data
Postgresqlの起動
postgresユーザになって、
# su postgres
起動。
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data -l logfile
データベースの作成とテスト
$ /usr/local/pgsql/bin/createdb test
$ /usr/local/pgsql/bin/psql test
test=# \q
パスを通す
/etc/profileに追記します。
if ! echo $PATH | /bin/grep -q "/usr/local/pgsql/bin" ; then
PATH="$PATH:/usr/local/pgsql/bin"
fi
Linux起動時にPostgreSQLを起動
/etc/rc.d/rc.localに追記します。
su -l postgres -c 'pg_ctl start -D /usr/local/pgsql/data -l logfile'