目次
本家のリポジトリを追加する。
# su - rpmdevel $ cd /home/rpmdevel/src $ wget http://yum.postgresql.org/9.3/redhat/rhel-6-i386/pgdg-centos93-9.3-1.noarch.rpm $ sudo rpm -ivh /home/rpmdevel/src/pgdg-centos93-9.3-1.noarch.rpm 警告: /home/rpmdevel/src/pgdg-centos93-9.3-1.noarch.rpm: ヘッダ V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY 準備中... ########################################### [100%] 1:pgdg-centos93 ########################################### [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.20-1.el6_5 updates postgresql-contrib.i686 8.4.20-1.el6_5 updates postgresql-devel.i686 8.4.20-1.el6_5 updates postgresql-docs.i686 8.4.20-1.el6_5 updates postgresql-jdbc.noarch 8.4.701-8.el6 base postgresql-libs.i686 8.4.20-1.el6_5 updates postgresql-odbc.i686 08.04.0200-1.el6 base postgresql-plperl.i686 8.4.20-1.el6_5 updates postgresql-plpython.i686 8.4.20-1.el6_5 updates postgresql-pltcl.i686 8.4.20-1.el6_5 updates postgresql-server.i686 8.4.20-1.el6_5 updates postgresql-test.i686 8.4.20-1.el6_5 updates postgresql93.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-contrib.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-debuginfo.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-devel.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-docs.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-jdbc.i686 9.3.1100-1PGDG.rhel6 pgdg93 postgresql93-jdbc-debuginfo.i686 9.3.1100-1PGDG.rhel6 pgdg93 postgresql93-libs.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-odbc.i686 09.02.0100-1PGDG.rhel6 pgdg93 postgresql93-odbc-debuginfo.i686 09.02.0100-1PGDG.rhel6 pgdg93 postgresql93-plperl.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-plpython.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-pltcl.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-server.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql93-test.i686 9.3.3-1PGDG.rhel6 pgdg93 postgresql_autodoc.noarch 1.41-1.rhel6 pgdg93 qt-postgresql.i686 1:4.6.2-28.el6_5 updates
# yum install postgresql93-server postgresql93-devel
postgres ユーザー
# id postgres uid=26(postgres) gid=26(postgres) 所属グループ=26(postgres)
バージョン
# psql --version psql (PostgreSQL) 9.3.3
chkconfig
# chkconfig --list | grep postgresql postgresql-9.3 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# su - postgres $ vi .bash_profile [ -f /etc/profile ] && source /etc/profile PGDATA=/var/lib/pgsql/9.3/data export PGDATA ↓修正 [ -f /etc/profile ] && source /etc/profile PGHOME=/usr/pgsql-9.3 PGDATA=/var/lib/pgsql/9.3/data PATH=$PATH:$PGHOME/bin export PGHOME PGDATA PGLIB
# /etc/rc.d/init.d/postgresql-9.3 start /var/lib/pgsql/9.3/data is missing. Use "service postgresql-9.3 initdb" to initialize the cluster first. [失敗]
失敗するので指示の通り、
# service postgresql-9.3 initdb --encoding=EUC_JP --no-locale データベースを初期化中: [ OK ]
再度、
# /etc/rc.d/init.d/postgresql-9.3 start postgresql-9.3 サービスを開始中: [ OK ]
自動起動
# chkconfig postgresql-9.3 on