在 AWS 上安裝 PostgreSQL 12


之前遇上一個需求,需要在 Amazon Linux AMI 上(因為不是在 Amazon Linux 2 AMI 上安裝 PostgreSQL 所以不能直接使用 amazon-linux-extras,殘念)安裝 PostgreSQL。
詳細流程大概是,讓 Django-crontab 定時使用 pg_dump 備份資料庫,而要用到 pg_dump 就必須安裝 PostgreSQL(其實也可以只安裝 postgresql-client 就好,不過在這邊不這樣做)

要在 AMI 上安裝應用程式首先要知道 AMI 的 OS 以及其的套件管理工具
AMI OS 是 CentOS 6、套件管理工具是 yum。

由於 AMI 上可以使用的 Repository 沒有我們想要的應用程式 PostgreSQL 12,所以我們要自己添加 Repository。

講這麼多,其實輸入下面這行就可以在你的 AMI 上安裝 PostgreSQL 12 了。

sudo yum install -y  https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-libs-12.2-2PGDG.rhel6.x86_64.rpm https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-12.2-2PGDG.rhel6.x86_64.rpm https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-server-12.2-2PGDG.rhel6.x86_64.rpm
#Amazon Machine Image #AMI #PostgreSQL 12 #postgresql






你可能感興趣的文章

[Py 百日馬 Day 2] Data Types

[Py 百日馬 Day 2] Data Types

【Git】- Git 的各種指令

【Git】- Git 的各種指令

Vue3 Proxy ? Vue2 Define Property 的不同?

Vue3 Proxy ? Vue2 Define Property 的不同?






留言討論