2014年10月25日土曜日

AWS EC2のPostgresを9.2から9.3にバージョンアップする方法

EC2とRDSの環境でRailsのdb:migrateしたら、おこられました。
pg_dump:
server version: 9.3.3; pg_dump version: 9.2.9
pg_dump: aborting because of server version mismatch
rake aborted!
ほったらかしにしておいた環境なので、気がついたら、RDSだけPostgresのバージョンが上がっていました。
そのため、EC2側のPostgresを9.3にバージョンアップすることにしました。

インストールされているPostgresの確認

    rpm -qa | grep postgres
をすると、9.2系が入ってることが確認できます。
postgresql92-libs-9.2.9-1.46.amzn1.x86_64
postgresql92-9.2.9-1.46.amzn1.x86_64
postgresql92-devel-9.2.9-1.46.amzn1.x86_64

Postgres9.2のアンインストール

9.2を削除します。
削除方法は下記。
rpm -e postgresql92-libs-9.2.9-1.46.amzn1.x86_64 postgresql92-9.2.9-1.46.amzn1.x86_64 postgresql92-devel-9.2.9-1.46.amzn1.x86_64

Postgres9.3のインストール

yum list すると、Postgresの9.3系は、以下が入っていることが確認できます。
postgresql93.x86_64            
postgresql93-contrib.x86_64    
postgresql93-devel.x86_64      
postgresql93-docs.x86_64       
postgresql93-libs.i686         
postgresql93-libs.x86_64       
postgresql93-plperl.x86_64     
postgresql93-plpython.x86_64   
postgresql93-pltcl.x86_64      
postgresql93-server.x86_64
postgresql93-test.x86_64
この中から、必要なものをインストールしていきます。
それぞれの、パッケージは以下の通りです。
パッケージ名 主に格納しているもの
postgresql-libs libpqなどのPostgreSQLのライブラリ群。PostgreSQL以外のパッケージが必要とすることもあります。
postgresql psqlやpg_dumpなどのPostgreSQLのクライアントユーティリティ
postgresql-server initdbやpg_ctlなどのPostgreSQLのサーバユーティリティ。DBMSサーバとして必要な機能はこれに含まれています。
postgresql-contrib pgbenchやpg_statstatementなどのPostgreSQLのcontribモジュール。
postgresql-devel PostgreSQLのヘッダやpg_configなどの開発用モジュール。
postgresql-doc PostgreSQLのドキュメント。
postgresql-test PostgreSQLのリグレッションテスト用モジュール。

インストール

今回、以下のリポジトリをインストールしました。
yum install postgresql93.x86_64
yum install postgresql93-devel.x86_64
yum install postgresql93-server.x86_64

インストールの確認

rpm -qa | grep postgres
postgresql93-9.3.5-1.52.amzn1.x86_64
postgresql93-devel-9.3.5-1.52.amzn1.x86_64
postgresql93-libs-9.3.5-1.52.amzn1.x86_64

参考サイト

http://lets.postgresql.jp/documents/tutorial/yum/yum
http://d.hatena.ne.jp/kasahi/20070819/1187545636

0 件のコメント:

コメントを投稿

statistics

Arsip