PostgreSQL のインストール(CentOS 8 でパッケージから)
はじめに
この手順では CentOS 8 系に PostgreSQL をインストールする手順を説明します。
インストール対象の Alfresco Content Services および Alfresco Process Services でサポートされているバージョンのものを選択してください。
本手順に記載のバージョンは、サポート対象バージョンにあわせて適宜読み替えてください。
1.リポジトリ情報の登録
RPM パッケージをインストールします。(Repository Package に記載があります)
実行コマンド
# dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm組み込みのパッケージを無効化します
実行コマンド
# dnf -qy module disable postgresql2.PostgreSQL のインストール
次のコマンドで PostgreSQL をインストールします。
実行コマンド
# dnf install -y postgresql13-server3.PostgreSQL の設定
セットアップファイルを修正します。
実行コマンド
# vi /usr/pgsql-13/bin/postgresql-13-setup編集内容
# Initialize the database
initdbcmd="$PGENGINE/initdb --pgdata='$PGDATA' --no-locale -E UTF-8 -A scram-sha-256 --auth-local=peer --pwfile /dev/zero" ←"--no-locale -E UTF-8" を追加
initdbcmd+=" $PGSETUP_INITDB_OPTIONS"
$SU -l postgres -c "$initdbcmd" >> "$PGLOG" 2>&1 < /dev/nullデータベース領域を初期化します。
実行コマンド
# /usr/pgsql-13/bin/postgresql-13-setup initdb実行結果
Initializing database ... OKpostgresql.conf ファイルを修正します。ここで設定する値は要件にあわせて適宜変更してください。(参考:PostgreSQL 公式ドキュメント - 第19章 サーバの設定、Configure databases)
実行コマンド
# vi /var/lib/pgsql/13/data/postgresql.conf/var/lib/pgsql/10/data/postgresql.conf
# - Memory -
(中略)
max_connections = 275 # (change requires restart)
(中略)
shared_buffers = 512MB # min 128kB
(中略)
work_mem = 4MB # min 64kB
(中略)
wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
(中略)/var/lib/pgsql/10/data/postgresql.conf
# - Connection Settings -
listen_addresses = 'localhost' ←DBへの接続を許可するIPアドレスを設定 # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)(オプション) 必要に応じて pg_hba.conf ファイルを修正します。(参考:PostgreSQL 公式ドキュメント - 第20章 クライアント認証、PostgreSQL 公式ドキュメント - 20.1. pg_hba.confファイル)
実行コマンド
# vi /var/lib/pgsql/13/data/pg_hba.confPostgreSQL を起動します。
実行コマンド
# systemctl start postgresql-13 \
&& systemctl is-active postgresql-13 && systemctl status postgresql-13PostgreSQL の自動起動設定をします。
実行コマンド
# systemctl enable postgresql-13 \
&& systemctl is-enabled postgresql-13 && systemctl status postgresql-13