首页 > 数据库技术 > 详细

Centos7 PostgreSQL安装

时间:2015-10-17 13:27:55      阅读:284      评论:0      收藏:0      [点我收藏+]

Linux安装PostgreSQL 9.4步骤

一、安装PostgreSQL

CentOS 7 64bit

rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm

 

二、执行安装命令

yum update

yum install postgresql94-server postgresql94-contrib

三、验证是否安装成功

rpm -aq| grep postgres

执行结果如下:

postgresql94-libs-9.4.1-1PGDG.rhel7.x86_64
postgresql94-server-9.4.1-1PGDG.rhel7.x86_64
postgresql94-9.4.1-1PGDG.rhel7.x86_64
postgresql94-contrib-9.4.1-1PGDG.rhel7.x86_64

四、初始化数据库

CentOS 7 系统

/usr/pgsql-9.4/bin/postgresql94-setup initdb

五、启动服务并设置为开机启动

CentOS 7 系统

systemctl enable postgresql-9.4
systemctl start postgresql-9.4

六、开放防火墙端口

CentOS 7 系统

firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload

七、访问PostgreSQL

su - postgres

输出结果如下:

上一次登录:一 5月 18 15:17:29 CST 2015pts/0 上
-bash-4.2$

输入命令psql将看到PostgrSQL的版本信息。

psql (9.4.1)
输入 "help" 来获取帮助信息.

八、设置postgres用户密码

postgres=# \password postgres

 

Centos7 PostgreSQL安装

原文:http://www.cnblogs.com/lvk618/p/4887324.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!