3.3. PostgreSQL のインストール
インストール可能な PostgreSQL は、内部データベースのインストール中に satellite-installer ツールでインストールされたものと同じバージョンの PostgreSQL のみになります。PostgreSQL は、Red Hat Enterprise Linux 8 リポジトリーまたは Red Hat Enterprise Linux Server 7 リポジトリーを使用してインストールできます。Satellite は PostgreSQL バージョン 12 をサポートします。
3.3.1. Red Hat Enterprise Linux 8 への PostgreSQL のインストール リンクのコピーリンクがクリップボードにコピーされました!
手順
PostgreSQL をインストールするには、以下のコマンドを入力します。
# dnf install postgresql-server postgresql-evrPostgreSQL を初期化するには、以下のコマンドを入力します。
# postgresql-setup initdb/var/lib/pgsql/data/postgresql.confファイルで以下を行います。# vi /var/lib/pgsql/data/postgresql.conf#を削除して、着信接続をリッスンするようにします。listen_addresses = '*'/var/lib/pgsql/data/pg_hba.confファイルを編集します。# vi /var/lib/pgsql/data/pg_hba.conf以下の行をファイルに追加します。
host all all Satellite_ip/24 md5PostgreSQL サービスを起動し、有効にするには、以下のコマンドを実行します。
# systemctl start postgresql # systemctl enable postgresql外部 PostgreSQL サーバーで postgresql ポートを開きます。
# firewall-cmd --add-service=postgresql # firewall-cmd --runtime-to-permanentpostgresユーザーに切り替え、PostgreSQL クライアントを起動します。$ su - postgres -c psql3 つのデータベースと専用のロールを作成します。1 つは Satellite 用、1 つは Candlepin 用、もう 1 つは Pulp 用です。
CREATE USER "foreman" WITH PASSWORD 'Foreman_Password'; CREATE USER "candlepin" WITH PASSWORD 'Candlepin_Password'; CREATE USER "pulp" WITH PASSWORD 'Pulpcore_Password'; CREATE DATABASE foreman OWNER foreman; CREATE DATABASE candlepin OWNER candlepin; CREATE DATABASE pulpcore OWNER pulp;postgresユーザーをログアウトします。# \qSatellite Server から、データベースにアクセスできることをテストします。接続に成功した場合には、コマンドは
1を返します。# PGPASSWORD='Foreman_Password' psql -h postgres.example.com -p 5432 -U foreman -d foreman -c "SELECT 1 as ping" # PGPASSWORD='Candlepin_Password' psql -h postgres.example.com -p 5432 -U candlepin -d candlepin -c "SELECT 1 as ping" # PGPASSWORD='Pulpcore_Password' psql -h postgres.example.com -p 5432 -U pulp -d pulpcore -c "SELECT 1 as ping"
3.3.2. Red Hat Enterprise Linux 7 への PostgreSQL のインストール リンクのコピーリンクがクリップボードにコピーされました!
手順
PostgreSQL をインストールするには、以下のコマンドを入力します。
# yum install rh-postgresql12-postgresql-server \ rh-postgresql12-syspaths \ rh-postgresql12-postgresql-evrPostgreSQL を初期化するには、以下のコマンドを入力します。
# postgresql-setup initdb/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.confファイルを編集します。# vi /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf#を削除して、着信接続をリッスンするようにします。listen_addresses = '*'/var/opt/rh/rh-postgresql12/lib/pgsql/data/pg_hba.confファイルを編集します。# vi /var/opt/rh/rh-postgresql12/lib/pgsql/data/pg_hba.conf以下の行をファイルに追加します。
host all all Satellite_ip/24 md5PostgreSQL サービスを起動し、有効にするには、以下のコマンドを実行します。
# systemctl start postgresql # systemctl enable postgresql外部 PostgreSQL サーバーで postgresql ポートを開きます。
# firewall-cmd --add-service=postgresql # firewall-cmd --runtime-to-permanentpostgresユーザーに切り替え、PostgreSQL クライアントを起動します。$ su - postgres -c psql3 つのデータベースと専用のロールを作成します。1 つは Satellite 用、1 つは Candlepin 用、もう 1 つは Pulp 用です。
CREATE USER "foreman" WITH PASSWORD 'Foreman_Password'; CREATE USER "candlepin" WITH PASSWORD 'Candlepin_Password'; CREATE USER "pulp" WITH PASSWORD 'Pulpcore_Password'; CREATE DATABASE foreman OWNER foreman; CREATE DATABASE candlepin OWNER candlepin; CREATE DATABASE pulpcore OWNER pulp;postgresユーザーをログアウトします。# \qSatellite Server から、データベースにアクセスできることをテストします。接続に成功した場合には、コマンドは
1を返します。# PGPASSWORD='Foreman_Password' psql -h postgres.example.com -p 5432 -U foreman -d foreman -c "SELECT 1 as ping" # PGPASSWORD='Candlepin_Password' psql -h postgres.example.com -p 5432 -U candlepin -d candlepin -c "SELECT 1 as ping" # PGPASSWORD='Pulpcore_Password' psql -h postgres.example.com -p 5432 -U pulp -d pulpcore -c "SELECT 1 as ping"