一、安装postgresql11

1、Install the repository RPM: 添加RPM

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

2、Install the client packages: 安装PostgreSQL11

yum install postgresql11

3、Optionally install the server packages: 安装服务包  

yum install postgresql11-server

4、Optionally initialize the database and enable automatic start: 初始化数据库并使postgresql自启动

#初始化数据库
/usr/pgsql-11/bin/postgresql-11-setup initdb
systemctl enable postgresql-11
systemctl start postgresql-11

5、View Version: 查看版本

psql --version

以上或在其它操作系统中安装其它版本可参考:https://www.postgresql.org/download/linux/redhat/  

二、配置postgresql11

1、修改用户密码并创建新库

[root@localhost ~]# su - postgres
-bash-4.2$ psql -U postgres

 【修改postgre的密码】

postgres=# ALTER USER postgres WITH PASSWORD '123456'

 【创建数据库】

postgres=# CREATE DATABASE xxx OWNER postgres
成功后会提示:CREATE DATABASE

 【赋予用户postgres权限】

postgres=# GRANT ALL PRIVILEGES ON DATABASE xxx to postgres
成功提示:GRANT

 【退出】

postgres=# \q

 【直接登录】

-bash-4.2$ psql -U postgres -d xxx -h 127.0.0.1 -p 5432

2、开启远程访问

  vi /var/lib/pgsql/11/data/postgresql.conf
  修改#listen_addresses = 'localhost'  为  listen_addresses='*'
  当然,此处‘*’也可以改为任何你想开放的服务器IP

3、信任远程连接
  vi /var/lib/pgsql/11/data/pg_hba.conf
  修改如下内容,信任指定服务器连接
  # IPv4 local connections:
  host    all            all      127.0.0.1/32      trust
  host    all            all      10.211.55.6/32(需要连接的服务器IP)  trust

  当然,此处也可以改为任意服务器IP,适用于访问者IP为动态可变

  host    all            all      0.0.0.0/0    trust

4、重启postgresql

systemctl restart postgresql-11

  

CentOS7(64) yum安装、配置PostgreSQL 11的更多相关文章

  1. Centos7下yum安装配置nginx与php

    实现LNMP环境搭建. 开始安装Nginx和PHP-FPM之前,首先卸载系统中以前安装的Apache和PHP保证安装不会冲突.用root登录输入下面的命令: yum remve httpd* php* ...

  2. CentOS7使用yum安装配置Redis

    >>>>>>>>>>>>>>>>>>>>>>>>> ...

  3. CentOS7使用yum安装PostgreSQL和PostGIS

    更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合Cent ...

  4. centos7 yum安装配置redis 并设置密码

    原文:https://www.cnblogs.com/fanlinglong/p/6635828.html centos7 yum安装配置redis 并设置密码 1.设置Redis的仓库地址 yum ...

  5. 阿里云Centos7使用yum安装MySQL5.6的正确姿势

    阿里云Centos7使用yum安装MySQL5.6 阿里云Centos7使用yum安装MySQL5.6 前言:由于某些不可抗力,我要在自己的阿里云服务器上搭建hadoop+hive+mysql+tom ...

  6. centos7.0 yum 安装php服务器

    https://blog.csdn.net/jiaoshenmo/article/details/50923900 首先收一下:centos7.0用yum直接安装apache.php他们的默认版本是a ...

  7. CentOS7使用yum安装LNMP环境以后无法打开php页面

    CentOS7使用yum安装LNMP环境以后无法打开php页面 页面提示为File not found 查看nginx错误日志/var/log/nginx/error.log提示如下 原因分析 ngi ...

  8. centos7 下 yum 安装Nginx

    centos7 下 yum 安装和配置 Nginx 添加yum源 Nginx不在默认的yum源中,可以使用epel或者官网的yum源,这里使用官网的yum源 rpm -ivh http://nginx ...

  9. CentOS7 通过YUM安装MySQL5.7 linux

    CentOS7 通过YUM安装MySQL5.7 1.进入到要存放安装包的位置 cd /home/lnmp 2.查看系统中是否已安装 MySQL 服务,以下提供两种方式: rpm -qa | grep  ...

随机推荐

  1. 在Servlet中获取spring容器WebApplicationContext

    WebApplicationContext springContext = WebApplicationContextUtils.getRequiredWebApplicationContext(ge ...

  2. LXC vs Docker

    https://www.sumologic.com/blog/code/lxc-lxd-explaining-linux-containers/ see also: https://linuxcont ...

  3. web 自定义标签

    Web Components 标准非常重要的一个特性是,它使开发者能够将HTML页面的功能封装为 custom elements(自定义标签).而自定义标签的好处,就是在大型web开发的时候,可以封装 ...

  4. org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.entity.Dep#1]

    报错信息: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.zhuoshi.e ...

  5. 使用jquey 须掌握的常见知识点

    1.jquery获取标签.class.id.input的值 $("div")    $(".active")    $("#login") ...

  6. C语言 进制转换

    这个程序仅仅是由十进制转换为其他进制的过程,其转换的规则如下图所示. 我使用的思路:首先在除基的过程中用一个数组保存余数,然后在输出进制转换结果的时候倒序输出,并且在输出前判断余数是否大于10,如果大 ...

  7. 关于null的判断

    Java中[null]的判断: 1.[null]只能通过is null,is not null判断,任何与的 关系运算(比较,有大于.大于等于.小于.小于等于.等于.不等于六种运算)都是false. ...

  8. JavaScript获取元素尺寸和大小操作总结(转载)

    一.获取元素的行内样式 var obj = document.getElementById("test"); alert(obj.height + "\n" + ...

  9. 博客作业06--结构体&指针

    1.本章学习总结 1.1思维导图 1.2.本章学习体会 结构体突破了数组的局限,把不同类型有内在联系的数据汇聚成一个整体,这种新的构造数据类型,提供了更便利的手段,更好的实现代码功能.通过代码建立文件 ...

  10. 数据库中无数据时查询数据为空,但出现空指针异常的解决方案(转载https://blueskator.iteye.com/blog/2096026)

    异常:java.lang.NullPointerException 解决方案: try{ hotelImageList = ihotelImgManager.query(hiqc); }catch(E ...