赞
踩
postgre安装以及相关配置
1、安装存储库rpm包
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2、安装客户端软件包
yum install postgresql12
yum install postgresql12-server (服务器软件包)
sudo yum install postgresql12-devel
1、初始化数据库
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
#Initializing database ... OK
2、修改IP绑定
#修改配置文件
vi /var/lib/pgsql/12/data/postgresql.conf
#将监听地址修改为*
#默认listen_addresses配置是注释掉的,所以可以直接在配置文件开头加入该行
listen_addresses='*'
3、初始化数据库并启用自动启动
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12
4、配置防火墙
firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
6、修改用户密码
#切换用户,执行后提示符会变为 '-bash-4.2$'
su - postgres
#登录数据库,执行后提示符变为 'postgres=#'
psql -U postgres
#设置postgres用户密码为postgres
ALTER USER postgres WITH PASSWORD 'postgres'
# 退出数据库
\q
[](javascript:void(0)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。