#freeze
''目次''
#contents
~
----
*準備 [#e6b4f98b]
本家のリポジトリを追加する。
# su - rpmdevel
$ cd /home/rpmdevel/src
$ wget http://yum.postgresql.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm
# sudo rpm -ivh /home/rpmdevel/src/pgdg-centos92-9.2-6.noarch.rpm
警告: /home/rpmdevel/pgdg-centos92-9.2-6.noarch.rpm: ヘッダ V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
準備中... ########################################### [100%]
1:pgdg-centos92 ########################################### [100%]
~
確認
# yum list | grep postgresql
bacula-director-postgresql.i686 5.0.0-12.el6 base
bacula-storage-postgresql.i686 5.0.0-12.el6 base
freeradius-postgresql.i686 2.1.12-4.el6_3 base
postgresql.i686 8.4.13-1.el6_3 base
postgresql-contrib.i686 8.4.13-1.el6_3 base
postgresql-devel.i686 8.4.13-1.el6_3 base
postgresql-docs.i686 8.4.13-1.el6_3 base
postgresql-jdbc.noarch 8.4.701-8.el6 base
postgresql-libs.i686 8.4.13-1.el6_3 base
postgresql-odbc.i686 08.04.0200-1.el6 base
postgresql-plperl.i686 8.4.13-1.el6_3 base
postgresql-plpython.i686 8.4.13-1.el6_3 base
postgresql-pltcl.i686 8.4.13-1.el6_3 base
postgresql-server.i686 8.4.13-1.el6_3 base
postgresql-test.i686 8.4.13-1.el6_3 base
postgresql92.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-contrib.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-debuginfo.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-devel.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-docs.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-jdbc.i686 9.2.1002-1PGDG.rhel6 pgdg92
postgresql92-jdbc-debuginfo.i686 9.2.1002-1PGDG.rhel6 pgdg92
postgresql92-libs.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-odbc.i686 09.01.0200-1PGDG.rhel6 pgdg92
postgresql92-odbc-debuginfo.i686 09.01.0200-1PGDG.rhel6 pgdg92
postgresql92-plperl.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-plpython.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-pltcl.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-server.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql92-tcl.i686 2.0.0-1.rhel6 pgdg92
postgresql92-tcl-debuginfo.i686 2.0.0-1.rhel6 pgdg92
postgresql92-test.i686 9.2.4-1PGDG.rhel6 pgdg92
postgresql_autodoc.noarch 1.41-1.rhel6 pgdg92
qt-postgresql.i686 1:4.6.2-26.el6_4 updates
~
*インストール [#y16ed5be]
# yum install postgresql92-server postgresql92-devel
~
*確認 [#l4049992]
postgres ユーザー
# id postgres
uid=26(postgres) gid=26(postgres) 所属グループ=26(postgres)
~
バージョン
# psql --version
psql (PostgreSQL) 9.2.4
~
chkconfig
# chkconfig --list | grep postgresql
postgresql-9.2 0:off 1:off 2:off 3:off 4:off 5:off 6:off
~
*設定 [#hb0a2dea]
# su - postgres
$ vi .bash_profile
[ -f /etc/profile ] && source /etc/profile
PGDATA=/var/lib/pgsql/9.2/data
export PGDATA
↓
[ -f /etc/profile ] && source /etc/profile
PGHOME=/usr/pgsql-9.2
PGDATA=/var/lib/pgsql/9.2/data
PATH=$PATH:$PGHOME/bin
export PGHOME PGDATA PGLIB
*起動 [#a4e0b834]
# /etc/rc.d/init.d/postgresql-9.2 start
/var/lib/pgsql/9.2/data is missing. Use "service postgresql-9.2 initdb" to initialize the cluster first.
[失敗]
~
失敗するので指示の通り、
# service postgresql-9.2 initdb --encoding=EUC_JP --no-locale
データベースを初期化中: [ OK ]
~
再度、
# /etc/rc.d/init.d/postgresql-9.2 start
postgresql-9.2 サービスを開始中: [ OK ]
~
*設定 [#m1fbbfe2]
自動起動
# chkconfig postgresql-9.2 on
~