确定你是管理员,然后运行命令:

yum -y install postgresql-server postgresql-contrib

初始化数据库 postgresql-setup initdb

启动服务 systemctl start postgresql.service

添加开机加载服务 systemctl enable postgresql.service

安装wget

yum install wget

配置postgresql

vi /var/lib/pgsql/data/postgresql.conf

#listen_addresses = 'localhost'

改为

listen_addresses = '*'

vi /var/lib/pgsql/data/pg_hba.conf

host    all         all         127.0.0.1/32         ident

下面加上你的电脑ip

host    all         all         客户端ip/32         password

ip配置规则

32 -> 192.168.1.1/32 表示必须是来自这个IP地址的访问才合法;
24 -> 192.168.1.0/24 表示只要来自192.168.1.0 ~ 192.168.1.255的都合法;
16 -> 192.168.0.0/16 表示只要来自192.168.0.0 ~ 192.168.255.255的都合法;
8   -> 192.0.0.0/16 表示只要来自192.0.0.0 ~ 192.255.255.255的都合法;
0   -> 0.0.0.0/0 表示全部IP地址都合法,/左边的IP地址随便了只要是合法的IP地址即可;

设置数据库密码

centos会自动生成一个postgres用户

所以,切换用户su postgres

会出现bash-4.2$,在后边输入psql回车,会出现postgres=#,

输入:ALTER USER postgres WITH PASSWORD '123456';

这样,把数据库用户postgres的密码设置为123456了

输入 \q 退出 postgresql环境,然后su切换到root用户

重启服务

systemctl restart postgresql.service

centos7 安装 PostgreSql的更多相关文章

  1. CentOS7安装Postgresql

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

  2. Centos7安装 PostgreSQL步骤

    1. 安装服务器即可. Yum install postgresql-server Yum install postgresql-contrib 2. 验证是否安装成功: rpm -aq| grep ...

  3. 阿里云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 ...

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

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

  5. centos7安装postgresql和postgis

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

  6. Centos7 源码安装PostgreSQL Citus集群 (转载)

    citus的分布式集群目前在苏宁大规模应用,苏宁陈华军也做了很多技术分享和博客介绍.目前所有的教程都是rpm和pg一起安装,个人不喜欢,毕竟citus定位是个插件,我想在我已安装的pg上源码装一个ci ...

  7. CentOS7安装配置Bacula yum方法

    参考: https://www.baidu.com/link?url=o2QIy2YZWjsJPAFJuYFhrH3nPvtyRkSe-o5Q_FqFZ5E1EMOsIOmGeKm0HAonwHOw8 ...

  8. centos7 安装配置postgresql

    考:https://www.linuxidc.com/Linux/2017-10/147536.htm http://blog.51cto.com/12482328/2090844 https://w ...

  9. 19.CentOS7下PostgreSQL安装过程

    CentOS7下PostgreSQL安装过程 装包 sudo yum install postgresql-server postgresql-contrib 说明: 这种方式直接明了,其他方法也可以 ...

随机推荐

  1. Swift版音乐播放器(简化版)

    这几天闲着也是闲着,学习一下Swift的.于是到开源社区Download了个OC版的音乐播放器,练练手,在这里发扬开源精神. 希望对大家有帮助! 这个DEMO里.使用到了 AudioPlayer(对音 ...

  2. 使用Code First建模自引用关系笔记 asp.net core上使用redis探索(1) asp.net mvc控制器激活全分析 语言入门必学的基础知识你还记得么? 反射

    使用Code First建模自引用关系笔记   原文链接 一.Has方法: A.HasRequired(a => a.B); HasOptional:前者包含后者一个实例或者为null HasR ...

  3. 分布式消息服务DMS如何实现死信消息的消费

    本文部分内容节选自华为云帮助中心的分布式消息服务(DMS)服务的产品介绍 死信消息是什么 死信消息是指无法被正常消费的消息.分布式消息服务DMS支持对消息进行异常处理.当消息进行多次重复消费仍然失败后 ...

  4. Android中相机拍照

    Android中调用系统相机的api接口在android.hardware包中.包里面类主要用到了Camera类.该类里面包含几个内部类:Camera.Parameters.Camera.Camera ...

  5. linux 下载 图片

    linux  curl  下载图片 l=[] with open('ee.html','r',encoding='utf-8') as fr: for i in fr: ii=i.split('&qu ...

  6. js 四种调用方式 Method Invocation Pattern

    4.3. Invocation Invoking a function suspends the execution of the current function, passing control ...

  7. 技术的止境(客户价值第一,快速实现第二,边做边学,迅速成为牛人。紧贴客户的需求去做技术,立于不败之地。追求的目标:把一项产品去做好,用产品去养活自己和家人)good

    作为一个依靠技术来谋生的程序员,我最近一直在思考一个问题,有限的生命里,面对无限的技术更新,我要研究到什么程度才能算是完成我的成为技术大牛的目标呢?换而言之,那就是技术的止境在哪儿呢?深入的思考下去, ...

  8. 【关键字】volatile

    volatile 修饰的关键字,确保编译器不对成员变量进行任何优化: private volatile double d; // No optimization

  9. [BZOJ 3126] Photo

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=3126 [算法] 差分约束系统 注意SPFA判负环的条件应为 : 若所有点入队次数之和 ...

  10. 【POJ 2777】 Count Color

    [题目链接] http://poj.org/problem?id=2777 [算法] 线段树 [代码] #include <algorithm> #include <bitset&g ...