1 yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
2 yum install postgresql94-server postgresql94-contrib
3 /usr/pgsql-9.4/bin/postgresql94-setup initdb
开机启动
1 systemctl enable postgresql-9.4.service
启动postgresql
1 systemctl start postgresql-9.4.service
远程访问 允许所有IP访问
vi /var/lib/pgsql/9.4/data/postgresql.conf
listen_addresses ='*'
vi /var/lib/pgsql/9.4/data/pg_hba.conf
host all all 0.0.0.0/0 md5
修改密码
1 su postgres
2 psql -U postgres
3 ALTER USER postgres WITH PASSWORD 'yourpassword'
如果有防火墙,关掉或者加上
vi /usr/lib/firewalld/services/postgres94.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Postgres 9.4 Database service</short>
<description>Postgres</description>
<portprotocol="tcp"port="5432"/>
</service>
firewall-cmd --permanent --add-service=postgres94
firewall-cmd --reload
在windows上可以用pgAdmin连接管理。