1. 安装服务器即可。

Yum install postgresql-server

Yum install postgresql-contrib

2. 验证是否安装成功:

rpm -aq| grep postgres

3. 安装完成后,检查postgresql的服务状态

Systemctl status postgresql (一般不成功)

安装postgresql后需要初始化数据库

执行postgresql-setup initdb

4 .再次启动postgresql服务 

Systemctl status postgresql

5.启用开机自启动

systemctl enable postgresql-10
systemctl start postgresql-10

6.配置防火墙

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

7.修改用户密码

    su - postgres  切换用户,执行后提示符会变为 '-bash-4.2$'
    psql -U postgres 登录数据库,执行后提示符变为 'postgres=#'
    ALTER USER postgres WITH PASSWORD 'postgres'  设置postgres用户密码为postgres
    \q  退出数据库

8.开启远程访问

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

9.信任远程连接

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

10.重启服务

systemctl restart postgresql-10



11.postsql数据库命令

psql -U postgres
出现以下界面,说明已经进入到想要的数据库,可以进行想要的操作了。 

template1=# 。比如:
\l --查看系统中现存的数据库  create database test1DBName; --
创建数据库
\d  --查看数据库列表: 
12 .安装pgadmin4客户端连接linux中安装的postgresql。


Centos7安装 PostgreSQL步骤的更多相关文章

  1. Centos7安装moloch步骤

      Centos7安装moloch步骤 Moloch 是一个由AOL开源的,能够大规模的捕获IPv4数据包(PCAP).索引和数据库系统,由以下三个部分组成: capture :绑定interface ...

  2. CentOS7安装Postgresql

    执行命令 Yum install postgresql-server Yum install postgresql-contrib 安装完成后,检查postgresql的服务状态 Systemctl ...

  3. centos7安装postgresql和postgis

    1.安装步骤 -- 安装对应的rpm文件(其他系统的rpm包,请自行到https://yum.postgresql.org/下载)yum install -y https://download.pos ...

  4. centos7安装nagios步骤

    一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...

  5. 阿里云ecs centos7安装 postgresql 9.4

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

  6. CENTOS7安装DOCKER步骤以及安装阿里镜像加速后无法正常启动服务的问题2018年1月

    本文时间2017年12月7日,比较新,大家可以直接参考.有问题直接评论 我根据菜鸟教程通过yum install docker安装了docker,由于测试发现奇慢无比,所以就安装了阿里云的加速,随后也 ...

  7. centOS7安装docker步骤

    首先准备一台linux系统, Docker需要一个64位系统的系统,内核的版本必须大于3.10,可以用命令来检查是否满足要求: 满足条件后,下面开始正式安装步骤: 1.更新yum: sudo yum ...

  8. centos7 安装 PostgreSql

    确定你是管理员,然后运行命令: yum -y install postgresql-server postgresql-contrib 初始化数据库 postgresql-setup initdb 启 ...

  9. CentOS7 安装Postgresql 11+ 源码编译安装Postgis-2.5.2

    ####安装Postgresql-11yum install zlib-devel gcc makegroupadd postgresuseradd -g postgres postgrespassw ...

随机推荐

  1. KONG -- 配置 service 并添加 key-auth

    默认情况下, KONG 监听下面几个端口: 8000   这个端口用于监听客户端的 HTTP 请求,并转发给上游服务 8443   这个端口用于监听客户端的 HTTPS 请求,并转发给上游服务 800 ...

  2. hdu1695(莫比乌斯反演模板)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1695 题意: 对于 a, b, c, d, k . 有 x 属于 [a, b],  y 属于 [c, ...

  3. IT兄弟连 JavaWeb教程 jQuery对AJAX的支持经典面试题

    1.简述对Ajax的理解 AJAX是Asynchronous JavaScript and Xml异步的JavaScript和Xml.它一种用来改善用户体验的技术其实质是使用XMLHttpReques ...

  4. click点击事件先后顺序的问题

    //页面加载时,每秒钟调用一次var times = setInterval("loadFlws()","1000"); function loadFlws() ...

  5. windows下安装python包

    1.windows下成功安装好python后,在安装目录的Scripts目录下有easy_install和pip工具 2.如果没有安装pip,进入命令行,切换到python的安装目录下的Scripts ...

  6. AngularJs1.X学习--路由

    [三种使用说明:] $stateProvider.state('station.printQRCode', { //params: { 'parentOfficeId': null }, //一次性参 ...

  7. 【ACM】取石子 - 博弈论

    取石子(一) 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 一天,TT在寝室闲着无聊,和同寝的人玩起了取石子游戏,而由于条件有限,他/她们是用旺仔小馒头当作石子.游 ...

  8. 牛客网练习赛26B(简单的dp)

    题目链接:https://www.nowcoder.com/acm/contest/180/B 链接:https://www.nowcoder.com/acm/contest/180/B来源:牛客网 ...

  9. Java ping 主机 端口

    22:04:08.002 [main] INFO Ping - 目标地址 192.168.1.107 是否可到达:true 22:04:08.006 [main] INFO Ping - 执行命令 p ...

  10. (转)linux正则表达式详解

    linux正则表达式详解 http://blog.csdn.net/wuliowen/article/details/64131815 1:什么是正则表达式: 简单的说,正则表达式就是处理字符串的方法 ...