CentOS / RHEL Linux Install Postgresql Database Server

CentOS / RHEL Linux Install Postgresql Database Server

To install the PostgreSQL database server on CentOS or RHEL Linux, you will need to have root access or superuser privileges.

  1. First, add the PostgreSQL repository to your system by running the following command:
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
So‮.www:ecru‬lautturi.com
  1. Update the package database by running the following command:
sudo yum update
  1. Install PostgreSQL by running the following command:
sudo yum install postgresql12-server
  1. Initialize the PostgreSQL database by running the following command:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
  1. Start the PostgreSQL service by running the following command:
sudo systemctl start postgresql-12
  1. Enable the PostgreSQL service to start automatically at boot by running the following command:
sudo systemctl enable postgresql-12

After completing these steps, PostgreSQL should be installed and running on your system. You can connect to the PostgreSQL server using the psql command and specify the user and database you want to connect to. For example:

psql -U postgres

This will connect you to the PostgreSQL server as the postgres user, and you will be able to run SQL commands and manage the database from the command line.

Created Time:2017-10-27 14:56:36  Author:lautturi