アウトバウンドのインターネット接続のない Amazon Linux 2 に PostgreSQL 13 をインストールするため、PostgreSQL 13 のインストールに必要な rpm をリストアップした(依存するものも含む)。
事前準備
$ cat /etc/system-release Amazon Linux release 2 (Karoo) $ uname -r 4.14.238-182.422.amzn2.x86_64
$ sudo vi /etc/yum.conf keepcache=1
- postgresql13、postgresql13-contrib をインストール
$ sudo rpm -ivh --nodeps https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm $ sudo perl -i.org -pe 's/\$releasever/7/g' /etc/yum.repos.d/pgdg-redhat-all.repo $ sudo yum install -y postgresql13 postgresql13-contrib
- postgresql13-devel をインストール
$ yum -y install epel-release centos-release-scl $ sudo amazon-linux-extras install epel $ sudo yum-config-manager --add-repo http://mirror.centos.org/centos/7/sclo/x86_64/rh/ $ sudo su - # cd /etc/yum.repos.d/ # cp -p mirror.centos.org_centos_7_sclo_x86_64_rh_.repo mirror.centos.org_centos_7_sclo_x86_64_rh_.repo.org # vi mirror.centos.org_centos_7_sclo_x86_64_rh_.repo # exit $ sudo curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo https://raw.githubusercontent.com/sclorg/centos-release-scl/master/centos-release-scl/RPM-GPG-KEY-CentOS-SIG-SCLo $ sudo yum install -y postgresql13-devel
確認
$ cd /var/cache/yum/x86_64/2 $ find . -name '*.rpm' ./amzn2-core/packages/libxslt-1.1.28-6.amzn2.x86_64.rpm ./amzn2-core/packages/audit-libs-python-2.8.1-3.amzn2.1.x86_64.rpm ./amzn2-core/packages/checkpolicy-2.5-6.amzn2.x86_64.rpm ./amzn2-core/packages/glibc-devel-2.26-48.amzn2.x86_64.rpm ./amzn2-core/packages/kernel-headers-4.14.238-182.422.amzn2.x86_64.rpm ./amzn2-core/packages/glibc-headers-2.26-48.amzn2.x86_64.rpm ./amzn2-core/packages/libcgroup-0.41-21.amzn2.x86_64.rpm ./amzn2-core/packages/libedit-devel-3.0-12.20121213cvs.amzn2.0.2.x86_64.rpm ./amzn2-core/packages/libicu-devel-50.2-4.amzn2.x86_64.rpm ./amzn2-core/packages/libmpc-1.0.1-3.amzn2.0.2.x86_64.rpm ./amzn2-core/packages/libselinux-python-2.5-12.amzn2.0.2.x86_64.rpm ./amzn2-core/packages/libsemanage-python-2.5-11.amzn2.x86_64.rpm ./amzn2-core/packages/mpfr-3.1.1-4.amzn2.0.2.x86_64.rpm ./amzn2-core/packages/ncurses-compat-libs-6.0-8.20170212.amzn2.1.3.x86_64.rpm ./amzn2-core/packages/ncurses-devel-6.0-8.20170212.amzn2.1.3.x86_64.rpm ./amzn2-core/packages/ncurses-c++-libs-6.0-8.20170212.amzn2.1.3.x86_64.rpm ./amzn2-core/packages/policycoreutils-python-2.5-22.amzn2.x86_64.rpm ./amzn2-core/packages/python-IPy-0.75-6.amzn2.0.1.noarch.rpm ./amzn2-core/packages/setools-libs-3.3.8-2.amzn2.0.2.x86_64.rpm ./pgdg13/packages/postgresql13-13.3-1PGDG.rhel7.x86_64.rpm ./pgdg13/packages/postgresql13-contrib-13.3-1PGDG.rhel7.x86_64.rpm ./pgdg13/packages/postgresql13-libs-13.3-1PGDG.rhel7.x86_64.rpm ./pgdg13/packages/postgresql13-server-13.3-1PGDG.rhel7.x86_64.rpm ./pgdg13/packages/postgresql13-devel-13.3-1PGDG.rhel7.x86_64.rpm ./amzn2extra-epel/packages/epel-release-7-11.noarch.rpm ./epel/packages/llvm5.0-5.0.1-7.el7.x86_64.rpm ./epel/packages/llvm5.0-devel-5.0.1-7.el7.x86_64.rpm ./epel/packages/llvm5.0-libs-5.0.1-7.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/devtoolset-7-gcc-7.3.1-5.16.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/devtoolset-7-gcc-c++-7.3.1-5.16.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/devtoolset-7-libstdc++-devel-7.3.1-5.16.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/devtoolset-7-runtime-7.1-4.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/llvm-toolset-7-clang-5.0.1-4.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/llvm-toolset-7-clang-libs-5.0.1-4.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/llvm-toolset-7-compiler-rt-5.0.1-2.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/llvm-toolset-7-libomp-5.0.1-2.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/llvm-toolset-7-llvm-libs-5.0.1-8.el7.x86_64.rpm ./mirror.centos.org_centos_7_sclo_x86_64_rh_/packages/llvm-toolset-7-runtime-5.0.1-4.el7.x86_64.rpm
- S3 にアップロードする
$ sudo su - # cd /var/cache/yum/x86_64/2 # find . -name "*.rpm"|xargs -n1 -I{} aws s3 cp {} s3://postgresql13-rpm/
別の環境にインストールする
sh-4.2$ sudo su - ec2-user $ aws configure AWS Access Key ID [None]: AWS Secret Access Key [None]: Default region name [None]: ap-northeast-1 Default output format [None]: $ aws s3 cp --recursive s3://postgresql13-rpm/ ./ $ ls -1 audit-libs-python-2.8.1-3.amzn2.1.x86_64.rpm checkpolicy-2.5-6.amzn2.x86_64.rpm devtoolset-7-gcc-7.3.1-5.16.el7.x86_64.rpm devtoolset-7-gcc-c++-7.3.1-5.16.el7.x86_64.rpm devtoolset-7-libstdc++-devel-7.3.1-5.16.el7.x86_64.rpm devtoolset-7-runtime-7.1-4.el7.x86_64.rpm epel-release-7-11.noarch.rpm glibc-devel-2.26-48.amzn2.x86_64.rpm glibc-headers-2.26-48.amzn2.x86_64.rpm jq-1.5-1.amzn2.0.2.x86_64.rpm kernel-headers-4.14.238-182.422.amzn2.x86_64.rpm libcgroup-0.41-21.amzn2.x86_64.rpm libedit-devel-3.0-12.20121213cvs.amzn2.0.2.x86_64.rpm libicu-devel-50.2-4.amzn2.x86_64.rpm libmpc-1.0.1-3.amzn2.0.2.x86_64.rpm libselinux-python-2.5-12.amzn2.0.2.x86_64.rpm libsemanage-python-2.5-11.amzn2.x86_64.rpm libxslt-1.1.28-6.amzn2.x86_64.rpm llvm5.0-5.0.1-7.el7.x86_64.rpm llvm5.0-devel-5.0.1-7.el7.x86_64.rpm llvm5.0-libs-5.0.1-7.el7.x86_64.rpm llvm-toolset-7-clang-5.0.1-4.el7.x86_64.rpm llvm-toolset-7-clang-libs-5.0.1-4.el7.x86_64.rpm llvm-toolset-7-compiler-rt-5.0.1-2.el7.x86_64.rpm llvm-toolset-7-libomp-5.0.1-2.el7.x86_64.rpm llvm-toolset-7-llvm-libs-5.0.1-8.el7.x86_64.rpm llvm-toolset-7-runtime-5.0.1-4.el7.x86_64.rpm mpfr-3.1.1-4.amzn2.0.2.x86_64.rpm ncurses-c++-libs-6.0-8.20170212.amzn2.1.3.x86_64.rpm ncurses-compat-libs-6.0-8.20170212.amzn2.1.3.x86_64.rpm ncurses-devel-6.0-8.20170212.amzn2.1.3.x86_64.rpm oniguruma-5.9.6-1.amzn2.0.4.x86_64.rpm policycoreutils-python-2.5-22.amzn2.x86_64.rpm postgresql13-13.3-1PGDG.rhel7.x86_64.rpm postgresql13-contrib-13.3-1PGDG.rhel7.x86_64.rpm postgresql13-devel-13.3-1PGDG.rhel7.x86_64.rpm postgresql13-libs-13.3-1PGDG.rhel7.x86_64.rpm postgresql13-server-13.3-1PGDG.rhel7.x86_64.rpm python-IPy-0.75-6.amzn2.0.1.noarch.rpm setools-libs-3.3.8-2.amzn2.0.2.x86_64.rpm
- rpm をインストールする
$ sudo rpm -ivh *.rpm warning: devtoolset-7-gcc-7.3.1-5.16.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY warning: llvm5.0-5.0.1-7.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY warning: postgresql13-13.3-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY Preparing... ################################# [100%] Updating / installing... 1:llvm-toolset-7-runtime-5.0.1-4.el################################# [ 3%] 2:postgresql13-libs-13.3-1PGDG.rhel################################# [ 5%] 3:ncurses-compat-libs-6.0-8.2017021################################# [ 8%] 4:llvm5.0-libs-5.0.1-7.el7 ################################# [ 10%] 5:postgresql13-13.3-1PGDG.rhel7 ################################# [ 13%] 6:mpfr-3.1.1-4.amzn2.0.2 ################################# [ 15%] 7:libmpc-1.0.1-3.amzn2.0.2 ################################# [ 18%] 8:llvm-toolset-7-llvm-libs-5.0.1-8.################################# [ 20%] 9:postgresql13-server-13.3-1PGDG.rh################################# [ 23%] 10:llvm5.0-5.0.1-7.el7 ################################# [ 25%] 11:llvm-toolset-7-compiler-rt-5.0.1-################################# [ 28%] 12:llvm-toolset-7-libomp-5.0.1-2.el7################################# [ 30%] 13:setools-libs-3.3.8-2.amzn2.0.2 ################################# [ 33%] 14:python-IPy-0.75-6.amzn2.0.1 ################################# [ 35%] 15:oniguruma-5.9.6-1.amzn2.0.4 ################################# [ 38%] 16:ncurses-c++-libs-6.0-8.20170212.a################################# [ 40%] 17:ncurses-devel-6.0-8.20170212.amzn################################# [ 43%] 18:libedit-devel-3.0-12.20121213cvs.################################# [ 45%] 19:llvm5.0-devel-5.0.1-7.el7 ################################# [ 48%] 20:libxslt-1.1.28-6.amzn2 ################################# [ 50%] 21:libsemanage-python-2.5-11.amzn2 ################################# [ 52%] 22:libselinux-python-2.5-12.amzn2.0.################################# [ 55%] 23:libicu-devel-50.2-4.amzn2 ################################# [ 58%] 24:libcgroup-0.41-21.amzn2 ################################# [ 60%] 25:kernel-headers-4.14.238-182.422.a################################# [ 63%] 26:glibc-headers-2.26-48.amzn2 ################################# [ 65%] 27:glibc-devel-2.26-48.amzn2 ################################# [ 68%] 28:checkpolicy-2.5-6.amzn2 ################################# [ 70%] 29:audit-libs-python-2.8.1-3.amzn2.1################################# [ 73%] 30:policycoreutils-python-2.5-22.amz################################# [ 75%] 31:devtoolset-7-runtime-7.1-4.el7 ################################# [ 78%] 32:devtoolset-7-libstdc++-devel-7.3.################################# [ 80%] 33:postgresql13-contrib-13.3-1PGDG.r################################# [ 83%] 34:jq-1.5-1.amzn2.0.2 ################################# [ 85%] 35:epel-release-7-11 ################################# [ 88%] 36:devtoolset-7-gcc-7.3.1-5.16.el7 ################################# [ 90%] 37:devtoolset-7-gcc-c++-7.3.1-5.16.e################################# [ 93%] 38:llvm-toolset-7-clang-libs-5.0.1-4################################# [ 95%] 39:llvm-toolset-7-clang-5.0.1-4.el7 ################################# [ 98%] 40:postgresql13-devel-13.3-1PGDG.rhe################################# [100%]