微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PostgreSQL安装手册Centos7

Linux系统为centOS7版本,postgresql为10版本

1.安装存储库RPM

sudo yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm

2.安装客户端软件包

sudo yum install postgresql10

3.安装服务器包

sudo yum install postgresql10-server

4.初始化数据库

sudo /usr/pgsql-10/bin/postgresql-10-setup initdb

5.切换到root用户

su root

6.修改postgres用户密码

passwd postgres

7.启动postgresql服务

sudo systemctl start postgresql-10

8. 设置postgresql开机⾃启动

sudo systemctl enable postgresql-10

9.切换到postgres⽤户

sudo su postgres

10.变成unix⻛格命令⾏输⼊ bash-4.2$

psql -U postgres

11.设置postgres⽤户密码

ALTER USER postgres WITH PASSWORD 'xxxxx';

12.postgres=# \q

13.bash-4.2$ exit

14.切换到root用户

sudo su root

15.开启远程访问

vi /var/lib/pgsql/10/data/postgresql.conf

修改" #listen_addresses='localhost' "为" listen_addresses='*' "

16.设置信任远程连接

vi /var/lib/pgsql/10/data/pg_hba.conf

修改

#IPv4 local connections:

 

host all all 127.0.0.1/32 md5

host all all 0.0.0.0/0 md5

17.重启postgresql服务

sudo systemctl stop postgresql-10

sudo systemctl start postgresql-10

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐