Install PostgreSQL 9 on CentOS

http://yum.pgrpms.org/reporpms/repoview/pgdg-centos.html

wget http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm


rpm -i pgdg-centos91-9.1-4.noarch.rpm

yum list postgres*
yum install postgresql91 postgresql91-devel postgresql91-server postgresql91-libs

chkconfig postgresql-9.1 on
service postgresql-9.1 start

# chkconfig postgresql on
# service postgresql start

#service postgresql-9.1 initdb
#service postgresql-9.1 start


su - postgres
psql -d template1 -U postgres

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

Устанавливаем пароль для пользователя postgres

passwd postgres

Создаем пробную базу

su - postgres
createdb demodb

Открываем порт в iptablese


vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
(-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT)

service iptables restart

/var/lib/pgsql/9.1

su postgres
# Создаем нового суперпользователя
createuser -P -s postgreadmin
# вводим пароль по запросу

pg_hba.conf
host all postgreadmin 127.0.0.1/32 password

# В файле postgresql.conf выставляем
listen_addresses = ‘*’