Unable to start postgresql service in Redhat linux 7

9k views Asked by At

I have installed postgresql 9.4 on Redhat 7 server.It was installed through postgresql-9.4.3-1-linux-x64.run. It displayed a clear message"postgres is installed your machine". Now when I login as

su - postgres

It doesn't ask for password and goes to bash prompt. If I type psql displays "command not found". When I tried starting service through root user

service postgresql initdb

I get:

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.

I tried start postgres restart which didn't work. I tried searching and found nothing. I know its with starting service.

1

There are 1 answers

0
Nicolai On BEST ANSWER

service postgresql initdb

initdb is an independent command to create a new database cluster.

initdb -- create a new PostgreSQL database cluster

initdb [option...] [--pgdata | -D] directory

You must use it independent, but not as argument for service command. Read documentation how to use this command: initdb

Use service postgresql start to start postgresql service and service postgresql stop to stop it.

psql: "command not found"

Try to switch into postgres user using su postgres command (without dash). It effects on $PATH environment variable.If this wouldn't help use full path to specify the command, for example /usr/bin/psql