CentOs8にPostgreSQL 13をインストールする
- 作成日 2020.07.15
- 更新日 2021.01.25
- centos7
- centos8, PostgreSQL 13, インストール

CentOs8にPostgreSQL 13をインストールする手順を記述してます。2020年7月の現時点ではPostgreSQL 13はベータ版となります。
環境
- OS CentOS 8.1.1911 (Core)
リポジトリ追加
まずはリポジトリを追加します。
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
PostgreSQL 13をインストール
リポジトリの追加が終われば、PostgreSQL 13をインストールします。
PostgreSQL AppStreamリポジトリを無効にします。
sudo dnf -qy module disable postgresql
テスト用のリポジトリを有効にします。
sudo dnf -y install dnf-utils
sudo yum-config-manager --enable pgdg13-updates-testing
リポジトリを確認します。
dnf repolist
<出力結果>
pgdg13-updates-testing PostgreSQL 13 for RHEL/CentOS 8 - x86_64 - Updates testing
PostgreSQL 13をインストールします。
sudo dnf install postgresql13-server
PostgreSQL 13初期化
初期化を行っておきます。
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
起動設定と開始を行います。
sudo systemctl enable --now postgresql-13
開始のみ場合は
sudo systemctl start postgresql-13
ステータスを確認します。
systemctl status postgresql-13
<出力結果>
● postgresql-13.service - PostgreSQL 13 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-13.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-07-15 12:15:41 JST; 20min ago
Docs: https://www.postgresql.org/docs/13/static/
Process: 4889 ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 4894 (postmaster)
Tasks: 8 (limit: 23983)
Memory: 17.1M
CGroup: /system.slice/postgresql-13.service
tq4894 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
tq4896 postgres: logger
tq4898 postgres: checkpointer
tq4899 postgres: background writer
tq4900 postgres: walwriter
tq4901 postgres: autovacuum launcher
tq4902 postgres: stats collector
mq4903 postgres: logical replication launcher
7月 15 12:15:41 localhost.localdomain systemd[1]: Starting PostgreSQL 13 database server...
7月 15 12:15:41 localhost.localdomain postmaster[4894]: 2020-07-15 12:15:41.691 JST [4894] LOG: ログ出力をログ収集プロセスにリダイレクトして>
7月 15 12:15:41 localhost.localdomain postmaster[4894]: 2020-07-15 12:15:41.691 JST [4894] ヒント: ここからのログ出力はディレクトリ"log"に現>
7月 15 12:15:41 localhost.localdomain systemd[1]: Started PostgreSQL 13 database server.
設定ファイル等は、下記の場所に存在します。
sudo ls /var/lib/pgsql/13/data/
<出力結果>
PG_VERSION global pg_dynshmem pg_logical pg_replslot pg_stat pg_tblspc pg_xact postmaster.opts
base log pg_hba.conf pg_multixact pg_serial pg_stat_tmp pg_twophase postgresql.auto.conf postmaster.pid
current_logfiles pg_commit_ts pg_ident.conf pg_notify pg_snapshots pg_subtrans pg_wal postgresql.conf
PostgreSQL13 管理ユーザーのパスワード設定
管理者ユーザーのパスワードを更新しておきます。
sudo su - postgres
psql -c "alter user postgres with password 'password'"
<出力結果>
ALTER ROLE
-
前の記事
CentOs7 niktoをインストールしてWEBサーバーの脆弱性を確認する 2020.07.15
-
次の記事
React.js ライブラリ「react-markdown-preview」を使ってマークダウンのプレビュー機能を実装する 2020.07.15
コメントを書く