一、安装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. vimrc配置

    "=========================================================================" DesCRiption 适合 ...

  2. linux系统中文件的权限

    查看文件权限的语句: 在终端输入:ls -l xxx.xxx (xxx.xxx是文件名) 那么就会出现相类似的信息,主要都是这些:-rw-rw-r-- 一共有10位数 其中: 最前面那个 - 代表的是 ...

  3. WEB学习笔记4-前端代码基本命名规法和格式规范

    1.HTML命名规范及格式规范 标签名和属性应该都小写,虽然HTML代码不区分大小写:属性值应该用双引号闭合. <IMG src=demo.jpg alt='test'/>(N) < ...

  4. Power BI 3-4月功能更新培训合集

    ​Power BI 3-4月功能更新培训合集 Power BI每月功能的更新,都有很多大咖精辟解读,我们一直也都是积极中期待,相信所有P友如是或更甚. 视频学习可以结合微软Power BI 3-4月文 ...

  5. kettle并行运行时出现「Unknown error in KarafBlueprintWatcher」

    背景:在使用kettle 6进行大量数据并行抽取时,偶尔会出现「Unknown error in KarafBlueprintWatcher」的错误,详细的报错信息可以查看下面的代码块. ERROR: ...

  6. 前端axios下载excel(二进制)

    需求:通过后端接口下载excel文件,后端没有文件地址,返回二进制流文件 实现:axios(ajax类似) 主要代码: axios:设置返回数据格式为blob或者arraybuffer 如: var ...

  7. 安装系统后IP配置问题

    1.配置静态IP 在/etc/sysconfig/network-script/ifcfg-eth0 文件,网卡管理文件.修改为静态IP.IPADDR.网关.掩码等 同一台机器上的网卡不能配置在同一网 ...

  8. react+umi+dva+antd中dva的数据流图解

  9. 小程序获取图片base64编码

    项目中遇到了这个问题,在搜索过程中看到别人的博文,大多是下面这种方法,大致如下: let imgObj = { count: 1, success: (res) => { let tempFil ...

  10. 微信小程序生成二维码工具

    实现的效果 使用(非自适应) 完整代码请参考网址里https://github.com/tomfriwel/weapp-qrcode 页面wxml中放置绘制二维码的canvas: <canvas ...