Steps to install PostgreSQL version 14 on centos 7 ?
In this article, we will see the steps to install postgresql on Centos/RHEL Operating system.
The same steps can be followed to install any version, however you need to change the repo path according to the version.
Here we have installed PostgreSQL version 14 on Centos 7.4 Operating System.
1. Check for available version in centos repository.
[root@ngelinux001 ~]# yum list all | grep -i postgre postgresql.x86_64 9.2.21-1.el7 @anaconda postgresql-devel.x86_64 9.2.21-1.el7 @anaconda postgresql-docs.x86_64 9.2.21-1.el7 @anaconda postgresql-libs.x86_64 9.2.21-1.el7 @anaconda postgresql-odbc.x86_64 09.03.0100-2.el7 @anaconda postgresql-server.x86_64 9.2.21-1.el7 @anaconda qt-postgresql.x86_64 1:4.8.5-13.el7 @anaconda qt3-PostgreSQL.x86_64 3.3.8b-51.el7 @anaconda qt5-qtbase-postgresql.x86_64 5.6.2-1.el7 @anaconda freeradius-postgresql.x86_64 3.0.13-15.el7 base libreoffice-postgresql.x86_64 1:5.3.6.1-25.el7_9 updates pcp-pmda-postgresql.x86_64 4.3.2-13.el7_9 updates postgresql.i686 9.2.24-7.el7_9 updates postgresql.x86_64 9.2.24-7.el7_9 updates postgresql-contrib.x86_64 9.2.24-7.el7_9 updates postgresql-devel.i686 9.2.24-7.el7_9 updates postgresql-devel.x86_64 9.2.24-7.el7_9 updates postgresql-docs.x86_64 9.2.24-7.el7_9 updates postgresql-jdbc.noarch 9.2.1002-8.el7_8 updates
2. Create repo file for version 14 as its not available with CentOS repo.
[root@ngelinux001 yum.repos.d]# cat postgresql14.repo [postgre] name=PostGreSQL14 baseurl=https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-7.4-x86_64/ gpgcheck=0 enabled=1 [root@ngelinux001 yum.repos.d]#
3. Check if you are able to get packages from repo.
[root@ngelinux001 yum.repos.d]# yum repolist Loaded plugins: aliases, changelog, fastestmirror, kabi, langpacks, tmprepo, verify, versionlock Loading support for Red Hat kernel ABI postgre | 3.6 kB 00:00:00 (1/2): postgre/group_gz | 244 B 00:00:00 (2/2): postgre/primary_db | 107 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirrors.xtom.com * extras: mirror.fcix.net * updates: linux.mirrors.es.net repo id repo name status base/7/x86_64 CentOS-7 - Base 10,072 extras/7/x86_64 CentOS-7 - Extras 512 postgre PostGreSQL14 281 updates/7/x86_64 CentOS-7 - Updates 3,842 repolist: 14,707
4. Now search for the package name and version available.
[root@ngelinux001 yum.repos.d]# yum list all | grep -i postgre postgresql.x86_64 9.2.21-1.el7 @anaconda postgresql-devel.x86_64 9.2.21-1.el7 @anaconda postgresql-docs.x86_64 9.2.21-1.el7 @anaconda postgresql-libs.x86_64 9.2.21-1.el7 @anaconda postgresql-odbc.x86_64 09.03.0100-2.el7 @anaconda postgresql-server.x86_64 9.2.21-1.el7 @anaconda qt-postgresql.x86_64 1:4.8.5-13.el7 @anaconda qt3-PostgreSQL.x86_64 3.3.8b-51.el7 @anaconda qt5-qtbase-postgresql.x86_64 5.6.2-1.el7 @anaconda bgw_replstatus_14.x86_64 1.0.3-3.rhel7 postgre citus_14.x86_64 10.2.5-1.rhel7 postgre postgis32_14-gui.x86_64 3.2.1-1.rhel7 postgre postgis32_14-utils.x86_64 3.2.1-1.rhel7 postgre postgresql.i686 9.2.24-7.el7_9 updates postgresql.x86_64 9.2.24-7.el7_9 updates postgresql-contrib.x86_64 9.2.24-7.el7_9 updates postgresql-devel.i686 9.2.24-7.el7_9 updates postgresql-devel.x86_64 9.2.24-7.el7_9 updates postgresql-docs.x86_64 9.2.24-7.el7_9 updates postgresql-jdbc.noarch 9.2.1002-8.el7_8 updates postgresql-jdbc-javadoc.noarch 9.2.1002-8.el7_8 updates postgresql-libs.i686 9.2.24-7.el7_9 updates postgresql-libs.x86_64 9.2.24-7.el7_9 updates postgresql-plperl.x86_64 9.2.24-7.el7_9 updates postgresql-plpython.x86_64 9.2.24-7.el7_9 updates postgresql-pltcl.x86_64 9.2.24-7.el7_9 updates postgresql-server.x86_64 9.2.24-7.el7_9 updates postgresql-static.i686 9.2.24-7.el7_9 updates postgresql-static.x86_64 9.2.24-7.el7_9 updates postgresql-test.x86_64 9.2.24-7.el7_9 updates postgresql-unit_14.x86_64 7.4-1.rhel7 postgre postgresql-upgrade.x86_64 9.2.24-7.el7_9 updates postgresql14.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-contrib.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-devel.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-docs.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-libs.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-llvmjit.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-odbc.x86_64 13.02.0000-1PGDG.rhel7 postgre postgresql14-plperl.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-plpython3.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-pltcl.x86_64 14.3-1PGDG.rhel7 postgre postgresql14-server.x86_64 14.3-1PGDG.rhel7 postgre
5. Install the package on the server.
[root@ngelinux001 yum.repos.d]# yum install postgresql14.x86_64 Loaded plugins: aliases, changelog, fastestmirror, kabi, langpacks, tmprepo, verify, versionlock Loading support for Red Hat kernel ABI Loading mirror speeds from cached hostfile * base: mirrors.xtom.com * extras: mirror.fcix.net * updates: linux.mirrors.es.net Resolving Dependencies --> Running transaction check ---> Package postgresql14.x86_64 0:14.3-1PGDG.rhel7 will be installed --> Processing Dependency: postgresql14-libs(x86-64) = 14.3-1PGDG.rhel7 for package: postgresql14-14.3-1PGDG.rhel7.x86_64 --> Processing Dependency: lz4 for package: postgresql14-14.3-1PGDG.rhel7.x86_64 --> Running transaction check ---> Package lz4.x86_64 0:1.8.3-1.el7 will be installed ---> Package postgresql14-libs.x86_64 0:14.3-1PGDG.rhel7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================ Package Arch Version Repository Size ================================================================================================================================ Installing: postgresql14 x86_64 14.3-1PGDG.rhel7 postgre 1.5 M Installing for dependencies: lz4 x86_64 1.8.3-1.el7 base 85 k postgresql14-libs x86_64 14.3-1PGDG.rhel7 postgre 268 k Transaction Summary ================================================================================================================================ Install 1 Package (+2 Dependent packages) Total download size: 1.8 M Installed size: 8.9 M Is this ok [y/d/N]: y Downloading packages: (1/3): lz4-1.8.3-1.el7.x86_64.rpm | 85 kB 00:00:00 (2/3): postgresql14-libs-14.3-1PGDG.rhel7.x86_64.rpm | 268 kB 00:00:01 (3/3): postgresql14-14.3-1PGDG.rhel7.x86_64.rpm | 1.5 MB 00:00:01 -------------------------------------------------------------------------------------------------------------------------------- Total 1.1 MB/s | 1.8 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Installing : lz4-1.8.3-1.el7.x86_64 1/3 Installing : postgresql14-libs-14.3-1PGDG.rhel7.x86_64 2/3 Installing : postgresql14-14.3-1PGDG.rhel7.x86_64 3/3 failed to link /usr/bin/psql -> /etc/alternatives/pgsql-psql: /usr/bin/psql exists and it is not a symlink failed to link /usr/bin/clusterdb -> /etc/alternatives/pgsql-clusterdb: /usr/bin/clusterdb exists and it is not a symlink failed to link /usr/bin/createdb -> /etc/alternatives/pgsql-createdb: /usr/bin/createdb exists and it is not a symlink failed to link /usr/bin/createuser -> /etc/alternatives/pgsql-createuser: /usr/bin/createuser exists and it is not a symlink failed to link /usr/bin/dropdb -> /etc/alternatives/pgsql-dropdb: /usr/bin/dropdb exists and it is not a symlink failed to link /usr/bin/dropuser -> /etc/alternatives/pgsql-dropuser: /usr/bin/dropuser exists and it is not a symlink failed to link /usr/bin/pg_basebackup -> /etc/alternatives/pgsql-pg_basebackup: /usr/bin/pg_basebackup exists and it is not a symlink failed to link /usr/bin/pg_dump -> /etc/alternatives/pgsql-pg_dump: /usr/bin/pg_dump exists and it is not a symlink failed to link /usr/bin/pg_dumpall -> /etc/alternatives/pgsql-pg_dumpall: /usr/bin/pg_dumpall exists and it is not a symlink failed to link /usr/bin/pg_restore -> /etc/alternatives/pgsql-pg_restore: /usr/bin/pg_restore exists and it is not a symlink failed to link /usr/bin/reindexdb -> /etc/alternatives/pgsql-reindexdb: /usr/bin/reindexdb exists and it is not a symlink failed to link /usr/bin/vacuumdb -> /etc/alternatives/pgsql-vacuumdb: /usr/bin/vacuumdb exists and it is not a symlink Verifying : postgresql14-libs-14.3-1PGDG.rhel7.x86_64 1/3 Verifying : postgresql14-14.3-1PGDG.rhel7.x86_64 2/3 Verifying : lz4-1.8.3-1.el7.x86_64 3/3 Installed: postgresql14.x86_64 0:14.3-1PGDG.rhel7 Dependency Installed: lz4.x86_64 0:1.8.3-1.el7 postgresql14-libs.x86_64 0:14.3-1PGDG.rhel7 Complete! [root@ngelinux001 yum.repos.d]#

In case the new version does not work, we need to uninstall old version and install this back.