您的位置:首页 > 运维架构 > Linux

CentOS7 PostgreSQL9.6安装

2017-01-22 16:59 387 查看
使用yum安装

yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96-server.x86_64 postgresql96-contrib.x86_64

初始化数据库

/usr/pgsql-9.6/bin/postgresql96-setup initdb

设置开机启动

systemctl
enable postgresql-9.6.service

systemctl
start postgresql-9.6.service

开启远程访问 

修改/var/lib/pgsql/9.6/data目录下的pg_hba.conf(配置对数据库的访问权限)和 postgresql.conf(配置PostgreSQL数据库服务器的相应的参数)

/var/lib/pgsql/9.6/data/postgresql.conf listen_addresses
='*'

/var/lib/pgsql/9.6/data/pg_hba.conf
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    all             all             192.168.0.0/24        trust
# IPv6 local connections:

host    all             all             ::1/128                 trust


修改用户密码
su postgres
psql -U postgres
ALTER USER postgres WITH PASSWORD '123456'
\q
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: