In this article, we'll explain how to install PostgreSQL on AlmaLinux 8. We are installing the available latest version of PostgreSQL for now it is version 16. We'll keep updating the article as much as possible.
It is a powerful, open source object-relational database system. PostgreSQL runs on all major operating systems and comes with many features aimed to help developers build applications, administrators to protect data integrity and build fault-tolerant environments.
Install PostgreSQL on AlmaLinux
Let's get started with the installation process.
- AlmaLinux installed [servers](https://hostnextra.com/dedicated-server)
- A root user access or normal user with administrative privileges.
1 Update the server
Keep the server up to date
dnf update -y
Next, we need to install repository. It will help us to install latest version of PostgreSQL. Use following command to install it.
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Before we install PostgreSQL, we need to disable the built-in PostgreSQL because it might be the older version and it may get install rather than latest version using repository.
sudo dnf -qy module disable postgresql
Finally, execute following command to install PostgreSQL.
sudo dnf install -y postgresql16-server
In order to use the database module, first we need to initialize it.
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
Now, enable and start the PostgreSQL service using following command:
sudo systemctl enable postgresql-16
sudo systemctl start postgresql-16
That's it. We have successfully install PostgreSQL on AlmaLinux.