Can't start newly installed PostgreSQL on Fedora

1.4k Views Asked by At

I just installed PostgreSQL (9.3) on my Linux Fedora (21) - Shown below

  • yum installer returns 'already installed' as this is the second time I run it, to get a screengrab for you.

  • systemctl enable postgresq, seems to work. At least it returns no errors.

  • systemctl start postgresql fails. The log says "data directory "/ConfigDir" does not exist" So I guess that's the key.

But the /ConfigDir do exis. It's /usr/local/pgsql/data as is default on a Fedora PostgreSQL instalation. It is tough owned by user:postgres

I guess that the start of the postgres server service fails because it somehow can't see the directory, likely because it's not trying as user:postgres.

But I don't know how to check this, nor how to mend it.

[martin@helium ~]$ sudo yum install postgresql-server postgresql-contrib
[sudo] password for martin: 
Loaded plugins: langpacks
Package postgresql-server-9.3.9-1.fc21.x86_64 already installed and latest version
Package postgresql-contrib-9.3.9-1.fc21.x86_64 already installed and latest version
Nothing to do
[martin@helium ~]$ sudo systemctl enable postgresql
[martin@helium ~]$ sudo systemctl start postgresql
Job for postgresql.service failed. See "systemctl status postgresql.service" and "journalctl -xe" for details.
[martin@helium ~]$ journalctl -xn
-- Logs begin at Fri 2014-12-26 16:16:25 CET, end at Sun 2016-02-07 14:35:11 CET. --
Feb 07 14:35:06 helium.hvidberg.net sudo[3466]: martin : TTY=pts/0 ; PWD=/home/martin ; USER=root ; COMMAND=/bin/systemctl start postgresql
Feb 07 14:35:06 helium.hvidberg.net sudo[3466]: pam_unix(sudo:session): session opened for user root by martin(uid=0)
Feb 07 14:35:06 helium.hvidberg.net pg_ctl[3476]: FATAL:  data directory "/ConfigDir" does not exist
Feb 07 14:35:11 helium.hvidberg.net pg_ctl[3476]: pg_ctl: could not start server
Feb 07 14:35:11 helium.hvidberg.net pg_ctl[3476]: Examine the log output.
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: postgresql.service: control process exited, code=exited status=1
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: Failed to start PostgreSQL database server.
-- Subject: Unit postgresql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit postgresql.service has failed.
-- 
-- The result is failed.
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: Unit postgresql.service entered failed state.
Feb 07 14:35:11 helium.hvidberg.net systemd[1]: postgresql.service failed.
Feb 07 14:35:11 helium.hvidberg.net sudo[3466]: pam_unix(sudo:session): session closed for user root
[martin@helium ~]$ 

Change to root to be able to see the postgresql data directory

[root@helium data]# pwd
/usr/local/pgsql/data
[root@helium data]# ls -l
total 100
drwx------. 5 postgres postgres  4096 Feb  6 19:00 base
drwx------. 2 postgres postgres  4096 Feb  6 19:03 global
drwx------. 2 postgres postgres  4096 Feb  6 19:00 pg_clog
-rw-------. 1 postgres postgres  4476 Feb  6 19:00 pg_hba.conf
-rw-------. 1 postgres postgres  1636 Feb  6 19:00 pg_ident.conf
drwx------. 2 postgres postgres  4096 Feb  6 19:03 pg_log
drwx------. 4 postgres postgres  4096 Feb  6 19:00 pg_multixact
drwx------. 2 postgres postgres  4096 Feb  6 19:03 pg_notify
drwx------. 2 postgres postgres  4096 Feb  6 19:00 pg_serial
drwx------. 2 postgres postgres  4096 Feb  6 19:00 pg_snapshots
drwx------. 2 postgres postgres  4096 Feb  6 19:05 pg_stat
drwx------. 2 postgres postgres  4096 Feb  6 19:05 pg_stat_tmp
drwx------. 2 postgres postgres  4096 Feb  6 19:00 pg_subtrans
drwx------. 2 postgres postgres  4096 Feb  6 19:00 pg_tblspc
drwx------. 2 postgres postgres  4096 Feb  6 19:00 pg_twophase
-rw-------. 1 postgres postgres     4 Feb  6 19:00 PG_VERSION
drwx------. 3 postgres postgres  4096 Feb  6 19:00 pg_xlog
-rw-------. 1 postgres postgres 20733 Feb  7 10:26 postgresql.conf
-rw-------. 1 postgres postgres    47 Feb  6 19:03 postmaster.opts
[root@helium data]#
0

There are 0 best solutions below