centos7 离线安装 postgresql 9.6
download postgresql 9.6
https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/repoview/postgresqldbserver96.group.html
postgresql96-server - The programs needed to create and run a PostgreSQL server
https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/postgresql96-server-9.6.19-1PGDG.rhel7.x86_64.rpm
postgresql96 - PostgreSQL client programs and libraries
https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/postgresql96-9.6.19-1PGDG.rhel7.x86_64.rpm
postgresql96-contrib - Contributed source and binaries distributed with PostgreSQL
https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/postgresql96-contrib-9.6.19-1PGDG.rhel7.x86_64.rpm
postgresql96-libs - The shared libraries required for any PostgreSQL clients
https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/postgresql96-libs-9.6.19-1PGDG.rhel7.x86_64.rpm
create user
groupadd postgres -->创建组
useradd -g postgres postgres -->创建用户,属组为postgres
passwd postgres -->设置用户postgres密码
install rpm packages
按照顺序安装
rpm -Uvh postgresql96-libs-9.6.19-1PGDG.rhel7.x86_64.rpm
rpm -Uvh postgresql96-9.6.19-1PGDG.rhel7.x86_64.rpm
rpm -Uvh postgresql96-server-9.6.19-1PGDG.rhel7.x86_64.rpm
rpm -Uvh postgresql96-contrib-9.6.19-1PGDG.rhel7.x86_64.rpm
edit config files
cd /var/lib/pgsql/9.6/data
vim pg_hba.conf
host all all 0.0.0.0/32 md5
vim postgresql.conf
listen_addressed='*' 去掉注释并修改为
start postgresql 9.6
/usr/pgsql-9.6/bin/postgresql96-setup initdb
systemctl enable postgresql-9.6
systemctl start postgresql-9.6
set postgres password and remote connect
su postgres
psql
ALTER USER postgres with encrypted password '1234';
\q
firewall-cmd --state
systemctl stop firewalld.service
systemctl disable firewalld.service
来源:oschina
链接:https://my.oschina.net/finchxu/blog/4704926