PostgreSQL触ってみた(インストール)

1.PostgreSQLの本家が提供するyumリポジトリを使用するよう設定するrpmをインストール

# wget http://yum.pgrpm.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
 --2011-02-07 20:03:16--  http://yum.pgrpm.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
yum.pgrpm.org をDNSに問いあわせています... 77.79.103.58
yum.pgrpm.org|77.79.103.58|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 4623 (4.5K) [application/x-rpm]
`pgdg-centos-9.0-2.noarch.rpm' に保存中

100%[======================================>] 4,623       --.-K/s 時間 0s

2011-02-07 20:03:19 (152 MB/s) - `pgdg-centos-9.0-2.noarch.rpm' へ保存完了 [4623/4623]

# rpm -ivh pgdg-centos-9.0-2.noarch.rpm
警告: pgdg-centos-9.0-2.noarch.rpm: ヘッダ V3 DSA signature: NOKEY, key ID 442df0f8
準備中...                ########################################### [100%]
   1:pgdg-centos            ########################################### [100%]
#

2.[base]セクションと[updates]セクションの最後に"exclude=postgresql*"の一文を追記

vi /etc/yum.repos.d/CentOS-Base.repo

3.yum実行

# yum -y install 'postgresql90*'
(略)
Installed:
  postgresql90.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-contrib.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-debuginfo.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-devel.i386 0:9.0.2-2PGDG.rhel5
  postgresql90-devel.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-docs.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-jdbc.x86_64 0:9.0.801-1PGDG.rhel5
  postgresql90-jdbc-debuginfo.x86_64 0:9.0.801-1PGDG.rhel5
  postgresql90-libs.i386 0:9.0.2-2PGDG.rhel5
  postgresql90-libs.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-odbc.x86_64 0:09.00.0200-1PGDG.rhel5
  postgresql90-odbc-debuginfo.x86_64 0:09.00.0200-1PGDG.rhel5
  postgresql90-plperl.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-plpython.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-pltcl.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-server.x86_64 0:9.0.2-2PGDG.rhel5
  postgresql90-test.x86_64 0:9.0.2-2PGDG.rhel5

Dependency Installed:
  antlr.x86_64 0:2.7.6-4jpp.2
  gjdoc.x86_64 0:0.7.7-12.el5
  java-1.4.2-gcj-compat.x86_64 0:1.4.2.0-40jpp.115
  jpackage-utils.noarch 0:1.7.3-1jpp.2.el5
  libgcj.x86_64 0:4.1.2-48.el5
  libxml2.i386 0:2.6.26-2.1.2.8.el5_5.1
  libxslt.i386 0:1.1.17-2.el5_2.2
  unixODBC.x86_64 0:2.2.11-7.1
  uuid.x86_64 0:1.5.1-4.rhel5

Complete!
(! 26個も入りやがった……)

4.postgresユーザーの.bash_profileを編集
$ vi .bash_profile
以下3行を追加
PATH=/usr/pgsql-9.0/bin:$PATH
MANPATH=/usr/pgsql-9.0/share/man:$MANPATH
export PATH MANPATH