How to install PostgreSQL Database Server on CentOS 8





The PostgreSQL database management system, also known as Postgres, provides relational database management with an emphasis on extensibility and SQL conformance. POSTGRES was originally developed at the University of California, Berkeley to replace the Ingres database. Many web, mobile, geospatial, and analytics applications rely on PostgreSQL as their primary database. Let’s get started with the installation.








Configure VPSie cloud server

 

 

 



Those who already have a system up and running should skip this step and do update their system.




 

  1. Sign in to your system or register a newly created one by logging in to your VPSie account
  2. Connect by SSH using the credentials we emailed you.
  3. Once you have logged into your CentOS instance, run these commands to update your system.
sudo yum update





It is possible to install PostgreSQL versions from the CentOS 8 repositories. Open the terminal and type the following command to list the streams available for PostgreSQL:




# dnf module list postgresql





To enable PostgreSQL Stream 13, run the following command:



# dnf module enable postgresql:13



 

 

 

 

Once you have enabled PostgreSQL 13, you can move on to using the latest version. Now, we can able to install PostgreSQL by using the following command:

 

 

# dnf install postgresql-server

 

 

 

In order to prepare and set up a new database cluster using the newly installed software, run the following command:

 

 

# dnf install postgresql-initdb

Use the following command to start and enable PostgreSQL after initialization:

 

 

# systemctl enable postgresql
# systemctl start postgresql

 

 

 

Once the service has been enabled and started, run the following command to verify its status:

 

 

# systemctl status postgresql

 

 

To make PostgreSQL accessible remotely, enter the following command in the postgresql.conf file:

 

 

# vim /var/lib/pgsql/data/postgresql.conf

 

 

 

Navigate to the Connections and authentication section and remove the following comment:  

 

 

listen_addresses = '*'

 

 

Type the following command to restart the PostgreSQL service after saving and closing the configuration file:

 

 

# systemctl restart postgresql

 

 

 



 

PostgreSQL Firewall Configuration

 

 

 


 

Use the following command to allow remote access to PostgreSQL from the firewall, port 5432 is used to connect to PostgreSQL.

 

 

 

# firewall-cmd –add-port=5432/tcp –permanent

# firewall-cmd –reload








The installation process should have gone smoothly. It is now ready for use.Thanks for reading! I hope it was informative for you! 







Try VPSie for free today!