SOLVED Problem with PostgreSQL in WHM

Operating System & Version
CentOS v7.9.2009
cPanel & WHM Version
v100.0.11

Keves5

Member
Mar 15, 2022
5
0
1
Colombia
cPanel Access Level
Root Administrator
Hello, I would like your help with the following problem I tried to create a CPanel account to associate a domain from the WHM panel, when creating the account it gives me the following error:

Account Creation Status: failed (XID cpt5j9) The system failed to connect to the “PostgreSQL” database “postgres” because of an error: connection_failure (could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP /IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" ( ::1) and accepting TCP/IP connections on port 5432?) at /usr/local/cpanel/Whostmgr/ Accounts/Create.pm line 1374.
I tried restarting the PostgreSQL service thinking it would solve the problem, but it also gives me an error:

The Postgres database is not initialized. The system will now initialize it.initdb: directory "/var/lib/pgsql/data" exists but is not empty If you want to create a new database system, either remove or empty the directory "/var/lib/pgsql/data" or run initdb with an argument other than "/var/lib/pgsql/data". The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Done Waiting for “postgresql” to start ………failed.

Cpanel::Exception::Services::StartError Service Status
undefined status from Cpanel::ServiceManager::Services::Postgresql

Service Error
(XID 2u4952) The “postgresql” service failed to start.

Startup Log
Mar 15 16:36:57 vps-139996.iegrupo.co systemd[1]: Starting PostgreSQL database server...
Mar 15 16:36:57 vps-139996.iegrupo.co systemd[1]: postgresql.service: control process exited, code=exited status=1
Mar 15 16:36:57 vps-139996.iegrupo.co systemd[1]: Failed to start PostgreSQL database server.
Mar 15 16:36:57 vps-139996.iegrupo.co systemd[1]: Unit postgresql.service entered failed state.
Mar 15 16:36:57 vps-139996.iegrupo.co systemd[1]: postgresql.service failed.

postgresql has failed. Contact your system administrator if the service does not automagically recover.
I appreciate the help you can give me
 
Last edited by a moderator:

Keves5

Member
Mar 15, 2022
5
0
1
Colombia
cPanel Access Level
Root Administrator
Hello, thank you very much for the answer, I tried to reinstall it, but the error persisted

info [installpostgres] Installing Postgres...
Loaded plugins: fastestmirror, langpacks, universal-hooks
Loading mirror speeds from cached hostfile
* EA4: 208.74.123.61
* cpanel-addons-production-feed: 208.74.123.61
* cpanel-plugins: 208.74.123.61
Package postgresql-9.2.24-7.el7_9.x86_64 already installed and latest version
Package postgresql-devel-9.2.24-7.el7_9.x86_64 already installed and latest version
Package postgresql-libs-9.2.24-7.el7_9.x86_64 already installed and latest version
Package postgresql-server-9.2.24-7.el7_9.x86_64 already installed and latest version
No package rh-postgresql available.
No package rh-postgresql-devel available.
No package rh-postgresql-libs available.
No package rh-postgresql-server available.
Nothing to do
Use of uninitialized value $pg_data in concatenation (.) or string at /scripts/installpostgres line 135, <STDIN> line 1.
info [installpostgres] Updating postgresql configuration now...
warn [installpostgres] Failed to reload PostgreSQL: The “/usr/bin/pg_ctl -D /var/lib/pgsql/data reload” command (process 14114) reported error number 1 when it ended.
info [installpostgres] Failed to _update_db_passwd for postgres: 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"?

,
warn [installpostgres] Failed to reload PostgreSQL: The “/usr/bin/pg_ctl -D /var/lib/pgsql/data reload” command (process 14116) reported error number 1 when it ended.
Configuration successfully updated
info [installpostgres] Attempting to restart postgresql...
The PostgreSQL installation failed!

I decided to deactivate the service because I am not using PostgreSQL, I thought that WHM needed it, but apparently it is not, Will I have a problem if I leave it disabled?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,359
2,249
363
cPanel Access Level
Root Administrator
Here's the notes from Ausaf on that ticket:

"I enabled the service in WHM > Service Manager. Afterward, I installed the PostgreSQL config and added the users by navigating to WHM > Configure PostgreSQL."

After that work was performed, the PostGreSQL service was up and running normally.