1. In centos there is repos very old version. so we go to lastest files postgresql
  2. Copy the download location and curl the rpm into the server

    curl -O https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm

  3. Install the rpm

    rpm -ivh pgdg*

  4. Install the server, It will also install 2 other packages.

    yum install postgresql96-server

  5. Initialize DB

    su - postgres -c "/usr/pgsql-9.6/bin/initdb -D /var/lib/pgsql/data"

  6. Start server

    su - postgres -c "/usr/pgsql-9.6/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start"

  • I dont know what will happen if server reboots – nerkn Dec 8 '17 at 11:43

On CentOS 6.2 You should be able to auto start your postgres server by using chkconfig. you should be able to see what the service name is with something like

chkconfig --list | grep post

which on a C6 system I have to hand shows

postgresql      0:off   1:off   2:off    3:off    4:off    5:off    6:off

Your installation from the vendor repository would likely look like

postgresql-9.6      0:off   1:off   2:off    3:off    4:off    5:off    6:off

(disabled at all run levels). To enable it using chkconfig

chkconfig postgresql-9.6 on
chkconfig --list | grep post
postgresql-9.6  0:off   1:off   2:on    3:on    4:on    5:on    6:off

(enabled at run levels 2-5 off otherwise)

  • do you know why installation is very complicated and undocumented. I looked 2 official documentation from vendors, and 4 blogs, but I need to combine and find which works. Always a prompt show me there is error without solution or reason like my customers: they say "site is not working". Yes he didnt opened computer, or he is in flight mode, etc. that's the path where it goes reverse direction of success. – nerkn Dec 8 '17 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.