转自 : https://www.cnblogs.com/stulzq/p/7766409.htmlhtml
本文只讲PostgreSQL在CentOS 7.x 下的安装,其余系统请查看:https://www.postgresql.org/downloadsql
PostgreSQL 所用版本为:PostgreSQL 10数据库
1.安装存储库vim
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
2.安装客户端centos
yum install postgresql10
3.安装服务端bash
yum install postgresql10-server
4.验证是否安装成功服务器
rpm -aq| grep postgres
输出以下:tcp
4.初始化数据库post
/usr/pgsql-10/bin/postgresql-10-setup initdb
5.启用开机自启动spa
systemctl enable postgresql-10 systemctl start postgresql-10
6.配置防火墙
firewall-cmd --permanent --add-port=5432/tcp firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload
7.修改用户密码
su - postgres 切换用户,执行后提示符会变为 '-bash-4.2$' psql -U postgres 登陆数据库,执行后提示符变为 'postgres=#' ALTER USER postgres WITH PASSWORD 'postgres' 设置postgres用户密码为postgres \q 退出数据库
8.开启远程访问
vim /var/lib/pgsql/10/data/postgresql.conf 修改#listen_addresses = 'localhost' 为 listen_addresses='*' 固然,此处‘*’也能够改成任何你想开放的服务器IP
9.信任远程链接
vi m/var/lib/pgsql/10/data/pg_hba.conf 修改以下内容,信任指定服务器链接 # IPv4 local connections: host all all 127.0.0.1/32 trust host all all 192.168.157.1/32(须要链接的服务器IP) trust
10.重启服务
systemctl restart postgresql-10
11.使用DBMS软件链接
这里使用的是Navicat
链接成功: