Dependability and resilience are some of the key attributes that define PostgreSQL as the go-to Relational Database Management System (RDBMS) for both web-based and desktop-based software application projects.
Also, since PostgreSQL continues to find shelter under the umbrella of its global developer community, bugs and user issues related to database software’s life cycle are easily fixed thanks to its open-source status.
Therefore, PostgreSQL is a brand name in numerous enterprises invested in e-commerce platforms, financial transactions, and web traffic statistics. Also, the open-source nature of PostgreSQL embraces the addition of several programming languages’ functions to make its usability dynamic. These programming languages include the likes C/C++, Python, and Java.
The launch of PostgreSQL 14 displays outstanding speed enhancements. Therefore, constructing data-driven applications is no longer a hurdle for developers and administrators. Its improved performance relates to enhanced connection concurrency, query parallelism, logical replication, and high-write workloads.
Before we jump into the guided steps that will take us through the installation of PostgreSQL 14 on Rocky Linux and AlmaLinux, make sure you have root user privileges or you are a Sudoer user on your system.
Install PostgreSQL in Rocky Linux and AlamaLinux
Proceed to update your system to fix/apply the needed security patches responsible for its performance.
$ sudo dnf update
Next, list the default PostgreSQL repository module.
$ dnf module list postgresql
The above output confirms that the system’s AppStream only accommodates PostgreSQL 9.6, 10, 12, and 13.
However, we are interested in PostgreSQL 14, so you need to install its official repository for your Rocky Linux/AlmaLinux system with the following command.
$ sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
With the new repository for PostgreSQL 14 installed on our system, we need to get rid of the default PostgreSQL module by disabling it with the following command:
$ sudo dnf -qy module disable postgresql
Afterward, proceed to install the Client and Server package for PostgreSQL 14 with the following command:
$ sudo dnf install -y postgresql14-server
Initialize PostgreSQL Database Server
To initialize PostgreSQL 14, execute the following command, which will create PostgreSQL’s main configuration file.
$ sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
Next, start PostgreSQL with the following command:
$ sudo systemctl start postgresql-14
Finally, we need to enable PostgreSQL 14. This way, even when your system restarts, it will keep on executing without having to manually launch it.
$ sudo systemctl enable postgresql-14
Now check on the status of your PostgreSQL 14 installation to make sure it is running.
$ sudo systemctl status postgresql-14
Testing PostgreSQL Database Connection
Use the following command to connect to the PostgreSQL database.
$ sudo -u postgres psql
From here, you can secure your PostgreSQL 14 user (postgres) with a password via the command:
$ sudo passwd postgres
Afterward, you can re-login to the PostgreSQL shell and execute the needed database queries to propagate your data-driven projects.
PostgreSQL 14 is an improvement from its previous versions thanks to the new and improved features it brings to the table. Your Rocky Linux and AlmaLinux systems are now ready for your next big database project.