MENU

TOP

Personal

Linux
CD-RW

ncftp

PHP
PHPLIB

PHPUNIT

PostgreSQL
PostgreSQL7.0

Oracle
Oracle8iR2

Windows

Java

XML

Network

資格

Link

 
 
 
 
 
 
PostgreSQL7.0 install
PostgreSQL7.0のインストール

ソースファイルの取得
ftp://ftp.postgresql.org/pub/v7.0/postgresql-7.0.tar.gz

PostgreSQL用のスーパーユーザー作成
rootアカウントで
# useradd postgres
# mkdir /usr/local/pgsql
# chown postgres.postgres /usr/local/pgsql

環境変数
# su - postgres
% vi .bash_profile
下記青色の部分を追加
% cat .bash_profile
export PATH=$PATH:$HOME/bin:/usr/local/pgsql/bin
export MANPATH=$MANPATH:/usr/local/pgsql/man
export POSTGRES_HOME=/usr/local/pgsql
export PGLIB=$POSTGRES_HOME/lib
export PGDATA=$POSTGRES_HOME/data
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PGLIB
% source .bash_profile
% tar zxvf postgresql-7.0.tar.gz
% cd postgresql-7.0/src
% ./configure --enable-multibyte=EUC_JP
% make
% make install
% cd ../doc
% make install
% initdb --pglib=/usr/local/pgsql/lib
% postmaster -S -i

接続テスト
% createdb test
% psql test
test=# create table test(i int);
CREATE
test=# insert into test values(100);
INSERT 18866 1
test=# select * from test;
   i
-----
 100
(1 row)

test=# \q
% dropdb test
DROP DATABASE

・自動起動スクリプトファイルの作成。

pgsql
#! /bin/sh
# postgresql This is the init script for starting up the PostgreSQL
# server

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
# Pretty much need it for postmaster.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/local/pgsql/bin/postmaster ] || exit 0

case "$1" in
 start)
    echo -n "Starting postgresql service: "
    su - postgres -c '/usr/local/pgsql/bin/postmaster -S -i'
   sleep 3
   pid=`pidof postmaster`
   echo -n "postmaster [$pid]"
   touch /var/lock/subsys/postgresql
   echo $pid > /var/run/postmaster.pid
   echo
   ;;
 stop)
   echo -n "Stopping postgresql service: "
   killproc postmaster
   sleep 2
  rm -f /var/run/postmaster.pid
  rm -f /var/lock/subsys/postgresql
  rm -f /tmp/.s.PGSQL.*
  echo
  ;;
 status)
  status postmaster
  ;;
 restart)
   $0 stop
   $0 start
   ;;
 *)
 echo "Usage: postgresql {start|stop|status|restart}"
 exit 1
esac

exit 0
・pgsqlを/etc/rc.d/rc*.d以下にリンクを張る
rootアカウントで
# cp pgsql /etc/rc.d/init.d/
# chmod 755 /etc/rc.d/init.d/pgsql
# for I in 0 1 2 6; do
>ln -s ../init.d/pgsql /etc/rc.d/rc$I.d/K40pgsql
>done

# for I in 3 5; do
>ln -s ../init.d/pgsql /etc/rc.d/rc$I.d/S70pgsql
>done
K40,S70は、使われていない数値を入れて下さい。


これで終了です。

TOPに戻る