インストールした PostgreSQL を起動して動作の確認を行います。
また PostgreSQL の自動起動スクリプトを作成して OS 起動時に自動的に PostgreSQL を起動するように設定します。
PostgreSQL の起動と終了
PostgreSQL は以下のように起動します。
# su - postgres
$ pg_ctl start

$ pg_ctl start

PostgreSQL のステータスを表示させて起動の確認をします。
$ pg_ctl status

pg_ctl: postmaster is running (pid: 9280)
Command line was:
/usr/local/pgsql/bin/postmaster
Command line was:
/usr/local/pgsql/bin/postmaster
PostgreSQL を停止する場合は以下のように実行します。
$ pg_ctl stop
$ exit

$ exit

PostgreSQL の自動起動スクリプト
PostgreSQL の自動起動スクリプトを使うことで、サーバーマシンが起動するときに自動的に PostgreSQL を起動させることができます。
PostgreSQL の自動起動スクリプトは PostgreSQL のソースファイル(contrib/start-scripts/linux)に含まれています。
これを /etc/rc.d/init.d/pgsql ファイルとしてコピーします。
# install -o root -g root -m 755 /usr/local/src/postgresql-7.3.16/contrib/start-scripts/linux /etc/rc.d/init.d/pgsql

コピーした自動起動スクリプトの自動起動設定を行います。
# chkconfig --add pgsql

自動起動スクリプトを使って PostgreSQL を起動する場合は以下のように実行します。
# /etc/rc.d/init.d/pgsql start

自動起動スクリプトのダウンロード » pgsql