You can install only the same version of PostgreSQL that is installed with the {foreman-installer}
tool during an internal database installation.
{Project} supports PostgreSQL version 12.
-
To install PostgreSQL, enter the following command:
# dnf install postgresql-server
-
To initialize PostgreSQL, enter the following command:
# postgresql-setup initdb
-
Edit the
{postgresql-conf-dir}/postgresql.conf
file:# vi {postgresql-conf-dir}/postgresql.conf
Note that the default configuration of external PostgreSQL needs to be adjusted to work with {Project}. The base recommended external database configuration adjustments are as follows:
-
checkpoint_completion_target: 0.9
-
max_connections: 500
-
shared_buffers: 512MB
-
work_mem: 4MB
-
-
Remove the
#
and edit to listen to inbound connections:listen_addresses = '*'
-
Edit the
{postgresql-conf-dir}/pg_hba.conf
file:# vi {postgresql-conf-dir}/pg_hba.conf
-
Add the following line to the file:
host all all {Project}_ip/32 md5
-
To start, and enable PostgreSQL service, enter the following commands:
# systemctl enable --now postgresql
-
Open the postgresql port on the external PostgreSQL server:
# firewall-cmd --add-service=postgresql # firewall-cmd --runtime-to-permanent
-
Switch to the
postgres
user and start the PostgreSQL client:$ su - postgres -c psql
-
Create three databases and dedicated roles: one for {Project}, one for Candlepin, and one for 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;
-
Connect to the Pulp database:
postgres=# \c pulpcore You are now connected to database "pulpcore" as user "postgres".
-
Create the
hstore
extension:pulpcore=# CREATE EXTENSION IF NOT EXISTS "hstore"; CREATE EXTENSION
-
Exit the
postgres
user:# \q
-
From {ProjectServer}, test that you can access the database. If the connection succeeds, the commands return
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"