3.5. Installing PostgreSQL
You can install only the same version of PostgreSQL that is installed with the satellite-installer
tool during an internal database installation. You can install PostgreSQL using Red Hat Enterprise Linux Server 7 repositories or from an external source, as long as the version is supported. Satellite supports PostgreSQL version 12.1.
Procedure
To install PostgreSQL, enter the following command:
yum install rh-postgresql12-postgresql-server \ rh-postgresql12-syspaths \ rh-postgresql12-postgresql-evr
# yum install rh-postgresql12-postgresql-server \ rh-postgresql12-syspaths \ rh-postgresql12-postgresql-evr
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To initialize PostgreSQL, enter the following command:
postgresql-setup initdb
# postgresql-setup initdb
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf
file:vi /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf
# vi /var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the
#
and edit to listen to inbound connections:listen_addresses = '*'
listen_addresses = '*'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/var/opt/rh/rh-postgresql12/lib/pgsql/data/pg_hba.conf
file:vi /var/opt/rh/rh-postgresql12/lib/pgsql/data/pg_hba.conf
# vi /var/opt/rh/rh-postgresql12/lib/pgsql/data/pg_hba.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following line to the file:
host all all Satellite_ip/24 md5
host all all Satellite_ip/24 md5
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To start, and enable PostgreSQL service, enter the following commands:
systemctl start postgresql systemctl enable postgresql
# systemctl start postgresql # systemctl enable postgresql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open the postgresql port on the external PostgreSQL server:
firewall-cmd --add-service=postgresql firewall-cmd --runtime-to-permanent
# firewall-cmd --add-service=postgresql # firewall-cmd --runtime-to-permanent
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Switch to the
postgres
user and start the PostgreSQL client:su - postgres -c psql
$ su - postgres -c psql
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create two databases and dedicated roles, one for Satellite and one for Candlepin:
CREATE USER "foreman" WITH PASSWORD 'Foreman_Password'; CREATE USER "candlepin" WITH PASSWORD 'Candlepin_Password'; CREATE DATABASE foreman OWNER foreman; CREATE DATABASE candlepin OWNER candlepin;
CREATE USER "foreman" WITH PASSWORD 'Foreman_Password'; CREATE USER "candlepin" WITH PASSWORD 'Candlepin_Password'; CREATE DATABASE foreman OWNER foreman; CREATE DATABASE candlepin OWNER candlepin;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Exit the
postgres
user:\q
# \q
Copy to Clipboard Copied! Toggle word wrap Toggle overflow From Satellite Server, 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='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"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow