Instalando Postgresql 9.1 no CentOS 6 e Red Hat Enterprise 6.
# yum install wget
# cd /tmp
# wget http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-redhat91-9.1-5.noarch.rpm
# rpm -Uvh pgdg-redhat91-9.1-5.noarch.rpm
# yum install postgresql91-server
# cd /tmp
# wget http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-redhat91-9.1-5.noarch.rpm
# rpm -Uvh pgdg-redhat91-9.1-5.noarch.rpm
# yum install postgresql91-server
* Verificando pacotes instalados:
# rpm -qa | grep postgres
postgresql91-server-9.1.8-2PGDG.rhel6.x86_64 postgresql91-9.1.8-2PGDG.rhel6.x86_64 postgresql91-libs-9.1.8-2PGDG.rhel6.x86_64
# /etc/init.d/postgresql-9.1 initdb
# chkconfig postgresql-9.1 on
# chkconfig postgresql-9.1 on
initdb – Cria um serviço "postgresql-9.1" de inicialização automática no banco de dados PostgreSQL.
* Subindo o serviço:
# /etc/init.d/postgresql-9.1 start
* Verificando status do serviço:
# /etc/init.d/postgresql-9.1 status
(pid 2647) está em execução...
* Setar senha no usuário postgres
# sudo -u postgres psql
psql (9.1.8) Digite "help" para ajuda. postgres=# alter user postgres with encrypted password 'teste';
* Alterar
# vi /var/lib/pgsql/9.1/data/pg_hba.conf
# IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident
para
# IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
# /etc/init.d/postgresql-9.1 restart
* Testando
# psql -h localhost -U postgres -d postgres
Senha para usuário postgres: psql (9.1.8) Digite "help" para ajuda. postgres=#