Como inicio o Postgres no CentOS 6.5?

5

Sempre que tento iniciar o Postgres, isso me causa um erro. Mesmo se eu remover o diretório que ele reclama, ele ainda falhará.

[root@ip-172-31-15-65 init.d]# service postgresql start

/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first.
                                                           [FAILED]
[root@ip-172-31-15-65 init.d]# service postgresql initdb
Initializing database: mkdir: cannot create directory '/var/lib/pgsql/data/pg_log': File exists
                                                           [FAILED]
[root@ip-172-31-15-65 init.d]# rmdir /var/lib/pgsql/data/pg_log
[root@ip-172-31-15-65 init.d]# service postgresql start

/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first.
                                                           [FAILED]
[root@ip-172-31-15-65 init.d]# service postgresql initdb
Initializing database:                                     [FAILED]

[root@ip-172-31-15-65 init.d]# service postgresql initdb
Initializing database: mkdir: cannot create directory '/var/lib/pgsql/data/pg_log': File exists
                                                           [FAILED]

Versão: postgresql-server-8.4.20-1.el6_5.x86_64

    
por Chloe 05.07.2014 / 00:44

1 resposta

5

Isso funcionou.

rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm

yum install postgresql93-server postgresql93-contrib
service postgresql-9.3 initdb

/etc/init.d/postgresql-9.3 start
chkconfig postgresql-9.3 on

Isso também pode funcionar:

yum install pgdg-centos93.noarch # in place of rpm
service postgres-9.3 start # in place of init.d
    
por 05.07.2014 / 02:11