How do I start Postgres on CentOS 6.5?

24,713

This worked.

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

This might also work:

yum install pgdg-centos93.noarch # in place of rpm
service postgres-9.3 start # in place of init.d
Share:
24,713
Chloe
Author by

Chloe

Updated on September 18, 2022

Comments

  • Chloe
    Chloe over 1 year

    Whenever I try to start Postgres, it gives me an error. Even if I remove the directory it complains about, it still fails.

    [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]
    

    Version: postgresql-server-8.4.20-1.el6_5.x86_64