Install PostgreSQL in CentOS Print

  • Centos, postgreSQL, databases
  • 0

PostgreSQL is an advanced and powerful Object-Relational database management system (DBMS), with a strong reputation on enterprise environment, designed for scalability, performance, high availability, reliability and feature robustness.

Install

# dnf install postgresql postgrepsql-server postgresql-contrib

Please note at this time the PostgreSQL server is not ready to use yet, if you execute:

# psql -U postgres

You get an error like this:

psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

In order to fix it you need to:

Create/initialize the cluster:

# postgresql-setup --initdb --unit postgresql

Manage the Server process

Start the server

# systemctl start postgresql

Check the status

# systemctl status postgresql

Restart the server

# systemctl restart postgresql

Stop the server

# systemctl stop postgresql

Verify that the server starts with the Operating System

# sudo systemctl is-enabled postgresql

Start the service with the Operating System

# systemctl enable postgresql

Connect to the server

# su - postgres -c psql

Was this answer helpful?

« Back