为CentOS v6.3 安装最新版PostgreSQL

  目前最新的CentOS 6.3中,仍然使用的是PostgreSQL 8.4版本。为了满足另一应用系统的需求,必须安装PostgreSQL 9及以上版本。本文将叙述如何使用PostgreSQL官方软件仓库和YUM工具,实现自动安装PostgeSQL 9。我使用的CentOS版本为6.3,该操作方法同样适用于使用CentOS 5, RedHat或者Fedora版本的朋友,只是需要注意下载文件时有对应的版本选择。

  1、下载并安装PostgreSQL官方软件仓库

  访问,选择对应的操作系统版本,下载repo rpm文件。对应我的操作系统CentOS 6.3 32位版本,使用wget命令下载,操作如下:

[root@wardking ~]# wget



–2012-10-11 02:52:40–

Resolving yum.pgrpms.org… 98.129.198.114

Connecting to yum.pgrpms.org|98.129.198.114|:80… connected.

HTTP request sent, awaiting response… 200 OK

Length: 5328 (5.2K) [application/x-redhat-package-manager]

Saving to: pgdg-centos92-9.2-6.noarch.rpm



100%[==============================================================================================================================>] 5,328 24.7K/s in 0.2s



2012-10-11 02:52:42 (24.7 KB/s) – âœpgdg-centos92-9.2-6.noarch.rpmâ

  安装软件仓库

[root@wardking ~]# rpm -ivh pgdg-centos92-9.2-6.noarch.rpm

warning: pgdg-centos92-9.2-6.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY

Preparing… ########################################### [100%]

1:pgdg-centos92 ########################################### [100%]

  编辑CentOS-Base.repo,将目前的CentOS仓库中的版本排除

[root@wardking ~]# vi /etc/yum.repos.d/CentOS-Base.repo
# remarked out baseurl= line instead.



[base]

name=CentOS-$releasever – Base

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

exclude=postgresql*



#released updates

[updates]

name=CentOS-$releasever – Updates

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

exclude=postgresql*

  试一下,应该可以看到最新的PostgreSQL出现在可用软件列表中:

[root@wardking ~]# yum list postgres*

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.btte.net

* epel: mirrors.ustc.edu.cn

* extras: mirrors.btte.net

* rpmforge: mirror.fairway.ne.jp

* updates: mirrors.btte.net

base

extras

pgdg92

pgdg92/primary_db

updates

Installed Packages

postgresql.i686 8.4.13-1.el6_3

postgresql-contrib.i686 8.4.13-1.el6_3

postgresql-devel.i686 8.4.13-1.el6_3

postgresql-libs.i686 8.4.13-1.el6_3

postgresql-plperl.i686 8.4.13-1.el6_3

postgresql-server.i686 8.4.13-1.el6_3

Available Packages

postgresql-ip4r.i686 1.05-1.el6

postgresql-pgpool-II.i686 3.2.0-1.el6

postgresql-pgpool-II-devel.i686 3.2.0-1.el6

postgresql-pgpool-II-recovery.i686 3.2.0-1.el6

postgresql-plparrot.i686 0.04-5.el6

postgresql-plruby.i686 0.5.3-4.el6

postgresql-plruby-doc.i686 0.5.3-4.el6

postgresql-relay.i686 1.3-2.2.el6.rf

postgresql92.i686 9.2.1-1PGDG.rhel6

postgresql92-contrib.i686 9.2.1-1PGDG.rhel6

postgresql92-debuginfo.i686 9.2.1-1PGDG.rhel6

postgresql92-devel.i686 9.2.1-1PGDG.rhel6

postgresql92-docs.i686 9.2.1-1PGDG.rhel6

postgresql92-jdbc.i686 9.2.1000-1PGDG.rhel6

postgresql92-jdbc-debuginfo.i686 9.2.1000-1PGDG.rhel6

postgresql92-libs.i686 9.2.1-1PGDG.rhel6

postgresql92-odbc.i686 09.01.0200-1PGDG.rhel6

postgresql92-odbc-debuginfo.i686 09.01.0200-1PGDG.rhel6

postgresql92-plperl.i686 9.2.1-1PGDG.rhel6

postgresql92-plpython.i686 9.2.1-1PGDG.rhel6

postgresql92-pltcl.i686 9.2.1-1PGDG.rhel6

postgresql92-server.i686 9.2.1-1PGDG.rhel6

postgresql92-tcl.i686 2.0.0-1.rhel6

postgresql92-tcl-debuginfo.i686 2.0.0-1.rhel6

postgresql92-test.i686 9.2.1-1PGDG.rhel6

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10880.html