CentOS7 にポストグレスをインストールするには?

ショコラ
ショコラ

CentOS7 にポストグレスをインストールするには?

yumでキメマス。

もっさん先輩
もっさん先輩
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y epel-release centos-release-scl
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql14-server

手順

  1. CentOS7 のコンテナを起動します。
docker run --rm -it centos:7
  1. yum でポストグレスをインストールします。
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y epel-release centos-release-scl
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql14-server
  1. データベースを初期化します。
su -c '/usr/pgsql-14/bin/initdb -E UTF8 --locale=C' - postgres
  1. ポストグレスを開始します。
su -c '/usr/pgsql-14/bin/pg_ctl start' - postgres
  1. ポストグレスに入ってみましょう。
psql -U postgres
# psql -U postgres
psql (14.5)
Type "help" for help.

postgres=#

以上

Scroll to Top