Search
Close this search box.

How to install PostgreSQL Database Server on CentOS 8

Table of Contents

How to install PostgreSQL Database Server on CentOS 8

 

The PostgreSQL database management system, or Postgres, provides relational database management emphasizing extensibility and SQL conformance. POSTGRES was initially 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 the 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 logged into your CentOS instance, run these commands to update your system.
sudo yum update

 

t 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 use the latest version. Now, we can be able to install PostgreSQL by using the following command:

  

# dnf install postgresql-server

 

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 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! 

 

 

Why use SilverStripe? How to install on a VPSie

PostgreSQL is a powerful open-source relational database management system that is used to store and manage large amounts of data.

CentOS (Community Enterprise Operating System) is a Linux distribution that is based on Red Hat Enterprise Linux (RHEL).

You can install PostgreSQL on CentOS by running the following commands in the terminal:

sql
sudo yum update sudo yum install postgresql-server postgresql-contrib sudo postgresql-setup initdb sudo systemctl start postgresql sudo systemctl enable postgresql

The default user for PostgreSQL on CentOS is “postgres”.

You can create a new PostgreSQL user on CentOS by running the following command in the terminal:

css
sudo su - postgres createuser --interactive

You can access the PostgreSQL CLI on CentOS by running the following command in the terminal:

 
sudo su - postgres psql
Make a Comment
Share on
Facebook
Twitter
LinkedIn
Print
VPSie Cloud service

Fast and Secure Cloud VPS Service

Try FREE
For a month

The First 1 orders gets free discount today! Try Sign up on VPSie to get a chance to get the discount.