Technology

Installing PostgreSQL 14 on CentOS 7

PostgreSQL 14 has few improvements over previous versions, especially older ones, like 9.6. This includes automatic data direction using partitioning. So, let’s install it on CentOS 7.

yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql14-server postgresql14
/usr/pgsql-14/bin/postgresql-14-setup initdb
systemctl enable postgresql-14
service postgresql-14 start

Then you should login to the database and set password:

sudo -u postgres -i
psql
\password

Basic configuration includes firewall setup (if it’s active), access control and performance settings:

/var/lib/pgsql/14/data/pg_hba.conf
/var/lib/pgsql/14/data/postgresql.auto.conf

I strongly recommend visiting pgtune.leopard.in.ua for tuning parameters. Last thing is to set interface address on which server will be listening, it’s set in:

/var/lib/pgsql/14/data/postgresql.conf

Now you are good to go.