You have probably already heard about the Postgresql database system. This open-source database is very popular and has been around for over 30 years. This system provides proper support of SQL language which is used for database management and other operations like crud. PostgreSQL’s reputation is due to its robustness, high performance, and flexibility. This basic storage system is suitable for many web applications. Some of these global giants that rely on Postgresql include Trivago, Instagram, Spotify, Netflix, etc. This article is a complete guide to show how to setup PostgreSQL 15 on AlmaLinux.
As mentioned earlier, PostgreSQL, often referred to simply as “Postgres”, is a powerful open-source relational database management system (RDBMS). This language is known for its extensibility, reliability, and adherence to SQL (Structured Query Language) standards. PostgreSQL is designed to efficiently store and manage large volumes of structured data while providing advanced features and functionality. This database system supports both SQL (relational) and JSON (non-relational) querying. It is highly stable. At first, PostgreSQL was designed to run on Unix But, then it evolved to run on different platforms like Windows, MAC, or Solaris.
PostgreSQL (often referred to as Postgres) is a powerful database management system that contains important and effective features and capabilities. Some of its important features include:
The following features are added to the recent versions of PostgreSQL:
In this section, we will introduce of some steps to setup a PostgreSQL 15 database on AlmaLinux, For this reason, you will need a Linux VPS. Now follow the instructions:
Note that the default version of Postgres is on Appstream repositories of PostgreSQL 10.
sudo dnf module list PostgreSQL
Tip: To install the latest version you should install the PostgreSQL yum repository on your system.
--------------- AlmaLinux 9 --------------- sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
--------------- AlmaLinux 8 --------------- sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Now you can use the Yum repository when needed. The next action will be updating repositories. So use the following command for this reason:
sudo dnf update -y
You should disable the default module which here is PostgreSQL 15:
sudo dnf -qy module disable PostgreSQL
Now you can use the command below to proceed and install the PostgreSQL 15 client and server:
sudo dnf install -y postgresql15-server
You can insert Y and click on Enter, every time you are asked to import the GPG key.
This command will install PostgreSQL and other dependencies.
Use the following command to confirm the version of PostgreSQL:
psql -V
psql (PostgreSQL) 15.0
Before proceeding with the rest of the operation, we need to initialize the initdb database, because this database is responsible for creating the new PostgreSQL cluster. For initializing the database act as follows:
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
As you finish the installation process it is time to start the PostgreSQL service and ensure your database server is running:
You should start the PostgreSQL database server:
sudo systemctl start postgresql-15
Now you can enable the PostgreSQL server using the following command:
sudo systemctl enable postgresql-15
Use the following command to confirm that PostgreSQL is up and running:
sudo systemctl status postgresql-15
After you install PostgreSQL, a default database user named Postgres is created that does not require authentication or a password. So, in the next steps, due to security reasons, we have to create a day password. So let’s log in to the PostgreSQL shell by switching to the Postgres user:
sudo su -postgres
Now you should have access to the database prompt by running this command:
psql
As the final step, you should secure the user by setting a password for your security, so run the command below:
sudo passwd postgres
Now determine a new password and confirm. Then log in to PostgreSQL as a Postgres user:
are - postgres
Then use this command:
psql -c "ALTER USER postgres WITH PASSWORD 'your-password';"
The next time you want to log in to the database, you will be asked to authenticate:
su - postgres
Installing PostgreSQL on AlmaLinux is not that much difficult. As you can see, we tried to show you a step-by-step guide to help you do this task. Postgres is an advanced database that is the primary data store for mobiles and web applications, and already reached version 15.2 which was out on February 9th, 2023. Also, you thought about How to enable and connect to this database. Note that you can run PostgreSQL on any other operating system like Windows and Mac. You can share your ideas or questions related to this post with a comment.
How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.
In this article, we are going to teach you How to Install EPEL Repository on AlmaLinux. If you have ...
Varnish Cache technology increases performance by keeping duplicate web pages in memory. In effect, ...
What is your opinion about this Blog?