当前位置:
首页 >
Centos 7 安装 PostgreSQL
发布时间:2025/3/15
99
豆豆
生活随笔
收集整理的这篇文章主要介绍了
Centos 7 安装 PostgreSQL
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
本文只讲PostgreSQL在CentOS 7.x 下的安装,其他系统请查看:https://www.postgresql.org/download
PostgreSQL 所用版本为:PostgreSQL 10
1.安装存储库
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm2.安装客户端
yum install postgresql103.安装服务端
yum install postgresql10-server4.验证是否安装成功
rpm -aq| grep postgres输出如下:
4.初始化数据库
/usr/pgsql-10/bin/postgresql-10-setup initdb5.启用开机自启动
systemctl enable postgresql-10 systemctl start postgresql-106.配置防火墙
firewall-cmd --permanent --add-port=5432/tcp firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload7.修改用户密码
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='*'当然,此处‘*’也可以改为任何你想开放的服务器IP9.信任远程连接
vi m/var/lib/pgsql/10/data/pg_hba.conf修改如下内容,信任指定服务器连接# IPv4 local connections:host all all 127.0.0.1/32 trusthost all all 192.168.157.1/32(需要连接的服务器IP) trust10.重启服务
systemctl restart postgresql-1011.使用DBMS软件连接
这里使用的是Navicat
连接成功:
转载于:https://www.cnblogs.com/stulzq/p/7766409.html
总结
以上是生活随笔为你收集整理的Centos 7 安装 PostgreSQL的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Python sqlalchemy or
- 下一篇: 在Centos 6.5 X64下切割m3