Configure PostgreSQL by storing the database files in an alternative location, initializing the data directory, setting the database service to start on boot, and start the database service.
|
Note These are RHEL 7 commands. RHEL 6 users must translate the service commands into the old form.
|
- (Optional) If you want to store database files in an alternative location follow the steps in the section Specifying an Alternative PostgreSQL Data Directory on RHEL .
- (Optional) If you are migrating to PostgreSQL 11 from an older version follow the steps in the section Upgrading to PostgreSQL 11.
- Initialize the PostgreSQL data directory:
sudo -u postgres /usr/pgsql-11/bin/initdb --encoding UTF8 /var/lib/pgsql/11/data
- Set the database service to start on boot: chkconfig postgresql-11 on
- If you are migrating from PostgreSQL 9.5, you will need to stop the old version before proceeding to the next step.
systemctl stop postgresql-9.5
systemctl disable postgresql-9.5
- Start the database service:
systemctl enable postgresql-11
systemctl start postgresql-11