2013-12-14
參考
http://www.postgresql.org/download/linux/redhat/
CentOS 6.5 yum 只提供 PostgreSQL 8.4 的安裝,要用 yum 安裝 PostgreSQL 9.2 版要另想辦法。
[root@localhost ~]# yum list | grep postgresql
bacula-director-postgresql.x86_64 5.0.0-12.el6 base
bacula-storage-postgresql.x86_64 5.0.0-12.el6 base
freeradius-postgresql.x86_64 2.1.12-4.el6_3 base
postgresql.i686 8.4.18-1.el6_4 base
postgresql.x86_64 8.4.18-1.el6_4 base
postgresql-contrib.x86_64 8.4.18-1.el6_4 base
postgresql-devel.i686 8.4.18-1.el6_4 base
postgresql-devel.x86_64 8.4.18-1.el6_4 base
postgresql-docs.x86_64 8.4.18-1.el6_4 base
postgresql-jdbc.noarch 8.4.701-8.el6 base
postgresql-libs.i686 8.4.18-1.el6_4 base
postgresql-libs.x86_64 8.4.18-1.el6_4 base
postgresql-odbc.x86_64 08.04.0200-1.el6 base
postgresql-plperl.x86_64 8.4.18-1.el6_4 base
postgresql-plpython.x86_64 8.4.18-1.el6_4 base
postgresql-pltcl.x86_64 8.4.18-1.el6_4 base
postgresql-server.x86_64 8.4.18-1.el6_4 base
postgresql-test.x86_64 8.4.18-1.el6_4 base
qt-postgresql.i686 1:4.6.2-26.el6_4 base
qt-postgresql.x86_64 1:4.6.2-26.el6_4 base
[root@localhost ~]#
修改yum的repo設定檔
vi /etc/yum.repos.d/CentOS-Base.repo
(下圖)在[base]與[update]設定加上exclude=postgrsql*
下載安裝 PostgreSQL 9.2
[root@localhost ~]# rpm -Uvh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
Retrieving http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
warning: /var/tmp/rpm-tmp.N2sIVn: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ########################################### [100%]
1:pgdg-centos92 ########################################### [100%]
[root@localhost ~]# yum -y install postgresql92 postgresql92-server postgresql92-contrib
初始化DB
[root@localhost ~]# su - postgres -c /usr/pgsql-9.2/bin/initdb
...(略)
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data
or
/usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start
[root@localhost ~]#
設定檔案
/var/lib/pgsql/9.2/data/postgresql.conf
啟動DB服務
[root@localhost ~]# service postgresql-9.2 start
Starting postgresql-9.2 service: [ OK ]
[root@localhost ~]#
其他參數
[root@localhost ~]# service postgresql-9.2
Usage: /etc/init.d/postgresql-9.2 {start|stop|status|restart|upgrade|condrestart|try-restart|reload|force-reload|initdb}
(完)
沒有留言:
張貼留言