centos7离线rpm安装postgresql9.6

只愿长相守 提交于 2020-11-06 02:14:17

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 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!