このエントリーをはてなブックマークに追加


PostgreSQLコミュニティーベースのリポジトリを設定し最新を利用する

ディストリビューションが提供しているPostgreSQLのバージョンが古いな〜と思われている方、
PostgreSQLコミュニティーベースのリポジトリの追加方法を以下に記します。
本資料の動作確認はCentOS6で行いました。

関連記事

PostgreSQLのリポジトリ追加

以下のURLからリポジトリの情報を取得することができます。
PostgreSQL RPM Building Project - Repository Packages
http://yum.postgresql.org/repopackages.php

 

本記事を書いている時点のPostgreSQLの最新バージョンをyumコマンドでインストールすることができます。

01.gif
 

上記のURLに接続し使用しているOSのバージョンに対応したPostgreSQLのRPMsをダウンロードします。
今回はCentOS6のi386(32bit)を利用しているので CentOS6 - i386 をクリックしダウンロードしました。 注意

既にyumによりPostgreSQLをインストールしている場合は、以下のコマンドでアンインストールしてください。

rpm -e postgresql-server postgresql

ダウンロードしたファイルをインストール

以下のURLからディストリビューションとCPUアーキテクチャーにあったリンクをクリックしてください。
http://yum.postgresql.org/repopackages.php

今回使用した環境は(CentOS6 - i386)以下のrpmをブラウザを使ってダウンロードしました。
http://yum.postgresql.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm

  1. rootユーザにsuします。
  2. ダウンロードしたrpmを以下のコマンドでインストールします。
    rpm -ivh ダウンロードしたファイル名

以下、上記手順を本資料の確認環境で操作した時の出力です。

[sakura@centos6 ~]$ su -
パスワード:
[root@centos6 ~]# rpm -ivh /tmp/pgdg-centos92-9.2-6.noarch.rpm 
警告: /tmp/pgdg-centos92-9.2-6.noarch.rpm: ヘッダ V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
準備中...                ########################################### [100%]
   1:pgdg-centos92          ########################################### [100%]
[root@centos6 ~]# 

yum search コマンドで postgresql92 で検索した結果です。

[root@centos6 ~]# yum search postgresql92
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: www.ftp.ne.jp
========================== N/S Matched: postgresql92 ===========================
postgresql92-debuginfo.i686 : Debug information for package postgresql92
postgresql92-jdbc-debuginfo.i686 : Debug information for package
                                 : postgresql92-jdbc
postgresql92-odbc-debuginfo.i686 : Debug information for package
                                 : postgresql92-odbc
postgresql92-tcl-debuginfo.i686 : Debug information for package postgresql92-tcl
postgresql92.i686 : PostgreSQL client programs and libraries
postgresql92-contrib.i686 : Contributed source and binaries distributed with
                          : PostgreSQL
postgresql92-devel.i686 : PostgreSQL development header files and libraries
postgresql92-docs.i686 : Extra documentation for PostgreSQL
postgresql92-jdbc.i686 : JDBC driver for PostgreSQL
postgresql92-libs.i686 : The shared libraries required for any PostgreSQL
                       : clients
postgresql92-odbc.i686 : PostgreSQL ODBC driver
postgresql92-plperl.i686 : The Perl procedural language for PostgreSQL
postgresql92-plpython.i686 : The Python procedural language for PostgreSQL
postgresql92-pltcl.i686 : The Tcl procedural language for PostgreSQL
postgresql92-server.i686 : The programs needed to create and run a PostgreSQL
                         : server
postgresql92-tcl.i686 : A Tcl client library for PostgreSQL
postgresql92-test.i686 : The test suite distributed with PostgreSQL

  Name and summary matches only, use "search all" for everything.

PostgreSQLのインストール

上記でyumコマンドによる検索ができるようになったので、yum installを使用してPostgreSQLコミュニティーが提供しているrpmパッケージをインストールすることができるようになります。

以下のコマンドでPostgreSQL 9.2をインストールすることができました。

yum install postgresql92-server postgresql92

バージョンの確認

# psql --version
psql (PostgreSQL) 9.2.1

postgres本体などは、以下のディレクトリにインストールされていました。

/usr/pgsql-9.2

また、chkconfigで確認すると以下のように登録されていました。

# chkconfig --list | grep postgres
postgresql-9.2 	0:off	1:off	2:off	3:off	4:off	5:off	6:off

添付ファイル: file01.gif 632件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-03-20 (金) 22:08:00