一、安装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. where are you?

    #version_s#1.2#version_e# #update_s#https://files.cnblogs.com/files/dyh221/rank0410.zip#update_e#

  2. nova98 假区域链 骗人项目(vexx.pro的前身)

    首先,我是受害者. nova98前期是vexx.pro,前期推广送比特龙, 送3个,然后推广一个新人可以再拿到1.5个. 然后呢,现在就又推出一个新网站,nova98,把之前推广的人领到币全部清零,而 ...

  3. 抽象鸡类 abstract(抽象) base(基础) class(类型)

    # --> ''' class interface 接口: 建立关联的桥梁, 方便管理代码 (python中没有接口语法) 接口类: 用来定义功能的类 为继承它的子类提供功能 该类的功能法方法一 ...

  4. JAVA字符串的常见处理和操作

    1.纯数字字符串补0为指定位,格式化输出(例如00482这样) 使用String.format处理: int mNumber = 1; // 0 代表前面补充0 // 4 代表长度为4 // d 代表 ...

  5. Spring在项目中需要的配置

    要想了解Spring,首先要了解三层架构.....自行百度. 1.Spring相关概念: 少数jar+某一个功能的配置文件 Spring容器(轻量级):帮我们管理业务逻辑层,有很多业务逻辑对象,需要对 ...

  6. phpexcel 使用说明

    下面是总结的几个使用方法 include 'PHPExcel.php'; include 'PHPExcel/Writer/Excel2007.php'; //或者include 'PHPExcel/ ...

  7. js中 setTimeout延时0毫秒的作用

    经常看到setTimeout延时0ms的javascript代码,感到很迷惑,难道延时0ms和不延时不是一个道理吗?后来通过查资料以及实验得出以下两个作用,可能还有作用我还不知道,希望得知的朋友在后面 ...

  8. [转]EOS智能合约 & 私链激活 & 基本操作

    链接:https://www.jianshu.com/p/90dea623ffdf 简介 本篇文章,将跟大家介绍eos私链的激活.基础智能合约的安装,以及为大家演示转账等基础操作.还没有安装eos私链 ...

  9. mysql 唯一索引与null.md

    mysql 的唯一索引要求所有参与的列都不能够为 null 值,如果唯一索引中的任何一个元素含有 null 值,则唯一约束将不起作用. 示例代码 create table tb ( a int, b ...

  10. install kali on my x200

    1 下载kali镜像,选择tsinghua tuna mirror https://mirrors.tuna.tsinghua.edu.cn/kali-images/current/ 选择light版 ...