Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up Postgresql-93 on Centos 7

I followed this Almost idiot's guide to install postgresql and postgis on Centos 7 and got stuck starting the database itself with the following command:

[root@localhost cmaps]# service postgresql-9.3 initdb
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

If I install the postgresql package from Centos repository (version 9.2) the command works, but then I they don't have postgis, and there is no official posgresql-92 repository for Centos 7.

Any idea on what's happening?

Thank you!

like image 836
Gatuno Avatar asked Aug 05 '14 15:08

Gatuno


People also ask

How do I start PostgreSQL on CentOS?

For instance, in the last example, you were instructed to get to the Postgres prompt by first switching to the postgres user and then running psql to open the Postgres prompt. You could do this in one step by running the single command psql as the postgres user with sudo , like this: sudo -u postgres psql.


2 Answers

I had the same problem and solve it by changing the path

/usr/pgsql-9.3/bin/postgresql93-setup initdb

Note that the path is different

like image 160
veradiego31 Avatar answered Sep 27 '22 23:09

veradiego31


CentOS 7 is based on systemd. PostgreSQL packages use a different command for initdb there:

/usr/lib/pgsql-9.3/bin/postgresql93-setup initdb

On older versions, call the initscript directly.

/etc/init.d/postgresql-9.3 initdb
like image 43
Craig Ringer Avatar answered Sep 27 '22 23:09

Craig Ringer