LoginSignup
1
0

More than 3 years have passed since last update.

俺でもわかる `Amazon Linux` へ postgresql10パッケージをインストールする脳筋的解決技巧

Last updated at Posted at 2019-07-09

俺です。

Amazon Linux2向けの情報が多かったのでメモを残します。まだまだAmazon Linuxだって現役だい。

Amazon Linux用にPostgreSQL10系のpackageを入れないと死ぬという事案が起きたとします。

入れないと死ぬ事案

pg_dump -U saikyouser -h pgdb10.local  saikoudb > saikou.sql
パスワード:
pg_dump: サーババージョン: 10.7、pg_dump バージョン: 9.6.XX
pg_dump: サーババージョンの不整合のため処理を中断しています

解決方法

repoファイル作成

力こそパワー.repoファイルを作ります。

  • /etc/yum.repos.d/pgdg10.repo
[pgdg10]
name=PostgreSQL 10 - Amazon Linux AMI 201X.0X - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-10

[pgdg10-source]
name=PostgreSQL 10 Amazon Linux AMI 201X.0X - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/10/redhat/rhel-6-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-10

postgresql10パッケージのインストール

[root@iikunitukurokamakurabakufu.com yum.repos.d]# yum install postgresql10 --enablerepo=pgdg10
読み込んだプラグイン:priorities, update-motd, upgrade-helper
amzn-main                                                                               | 2.1 kB  00:00:00
amzn-updates                                                                            | 2.5 kB  00:00:00
pgdg10                                                                                  | 3.7 kB  00:00:00
(1/2): pgdg10/x86_64/group_gz                                                           |  245 B  00:00:01
(2/2): pgdg10/x86_64/primary_db                                                         | 222 kB  00:00:02
45 packages excluded due to repository priority protections
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ postgresql10.x86_64 0:10.9-1PGDG.rhel6 を インストール
--> 依存性の処理をしています: postgresql10-libs(x86-64) = 10.9-1PGDG.rhel6 のパッケージ: postgresql10-10.9-1PGDG.rhel6.x86_64
--> 依存性の処理をしています: libpq.so.5()(64bit) のパッケージ: postgresql10-10.9-1PGDG.rhel6.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ postgresql10-libs.x86_64 0:10.9-1PGDG.rhel6 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

===============================================================================================================
 Package                        アーキテクチャー    バージョン                       リポジトリー         容量
===============================================================================================================
インストール中:
 postgresql10                   x86_64              10.9-1PGDG.rhel6                 pgdg10              1.6 M
依存性関連でのインストールをします:
 postgresql10-libs              x86_64              10.9-1PGDG.rhel6                 pgdg10              326 k

トランザクションの要約
===============================================================================================================
インストール  1 パッケージ (+1 個の依存関係のパッケージ)

総ダウンロード容量: 1.9 M
インストール容量: 9.5 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): postgresql10-libs-10.9-1PGDG.rhel6.x86_64.rpm                                    | 326 kB  00:00:02
(2/2): postgresql10-10.9-1PGDG.rhel6.x86_64.rpm                                         | 1.6 MB  00:00:02
---------------------------------------------------------------------------------------------------------------
合計                                                                           759 kB/s | 1.9 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : postgresql10-libs-10.9-1PGDG.rhel6.x86_64                                      1/2
  インストール中          : postgresql10-10.9-1PGDG.rhel6.x86_64                                           2/2
  検証中                  : postgresql10-10.9-1PGDG.rhel6.x86_64                                           1/2
  検証中                  : postgresql10-libs-10.9-1PGDG.rhel6.x86_64                                      2/2

インストール:
  postgresql10.x86_64 0:10.9-1PGDG.rhel6

依存性関連をインストールしました:
  postgresql10-libs.x86_64 0:10.9-1PGDG.rhel6

完了しました!
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0