这篇文档,只是为了初次体验一下PostgreSQL 12。对于

PG有一个感观上面的认识。

1.创建postgres用户

groupadd postgres
useradd -g postgres postgres

2.查看操作系统版本

[root@db ~]# cat /etc/issue.bak
CentOS release 6.9 (Final)
Kernel \r on an \m

3.配置yum源(对应CentOS 6)

参考文档:https://www.postgresql.org/download/linux/redhat/

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-

repo-latest.noarch.rpm

4.安装客户端包

yum install postgresql12

5.安装服务器端包

yum install postgresql12-server

6.初始化数据库和设置自启动服务

service postgresql-12 initdb
chkconfig postgresql-12 on
service postgresql-12 start

7.postgres用户的bash_profile

在/home/postgres/.bash_profile中。添加如下:

PG_BIN=/usr/pgsql-12/bin
export PG_BIN

生效

source /home/postgres/.bash_profile

------------------邪恶的分割线---------------------

PG的启停服务

从pg的启动日志/var/lib/pgsql/12/pgstartup.log来分析:

  • 其数据目录是/var/lib/pgsql/12/data
  • 其二进制目录是/usr/pgsql-12/bin/

通过ps -ef 可以看到pg是通过postmaster进程,来推动pg的运行。如下:

[root@db data]# ps -ef |grep pg
postgres 14917 1 0 10:30 ? 00:00:00 /usr/pgsql-12/bin/postmaster -D
/var/lib/pgsql/12/data
root 15042 14534 0 10:35 pts/0 00:00:00 grep pg

自启动的方式启停pg服务

[root@db 12]# service postgresql-12 restart
Stopping postgresql-12 service: [ OK ]
Starting postgresql-12 service: [ OK ]
[root@db 12]# service postgresql-12 stop
Stopping postgresql-12 service: [ OK ]
[root@db 12]# service postgresql-12 start
Starting postgresql-12 service: [ OK ]

使用pg_ctl,启停pg的服务

关闭服务
[root@db 12]# su postgres -c '/usr/pgsql-12/bin/pg_ctl stop -D /var/lib/pgsql/12/data/ -l zsdpglog'
启动服务 [root@db 12]# su postgres -c '/usr/pgsql-12/bin/pg_ctl start -D /var/lib/pgsql/12/data/ -l zsdpglog'

使用postgres,启动pg的服务

[postgres@db bin]$ ./postgres -D /var/lib/pgsql/12/data/ > /home/postgres/zsdstartupPg.log 2>&1 &

如何使用和管理pg的启停服务,看个人喜好。

PostgreSQL 12 YUM安装的更多相关文章

  1. PostgreSQL 之 yum安装 postgis 插件

    版本说明: CentOS7.5 + PostgreSQL 10.5 参考资源: https://www.postgresql.org/download/linux/redhat/ http://dow ...

  2. CentOS7 源码安装 PostgreSQL 12

    PostgreSQL 12 源码安装 Table of Contents 1. 下载 2. 准备环境 3. 编译安装 4. 设置环境变量 5. 初始化数据库 6. 配置参数文件 6.1. postgr ...

  3. 与你相遇好幸运,CentOS 7 x86_64使用Yum安装PostgreSQL

    访问http://yum.pgrpms.org/reporpms/repoview/letter_p.group.html,下载并安装和当前系统对应的rpm文件. wget https://downl ...

  4. postgresql数据库的yum安装方法

    实验环境>>>>>>>>>>>>>>>>>>操作系统:CentOS release 6.3 ...

  5. CentOS 7 yum安装nginx-1.12.0

    CentOS 7 中的 yum 没法直接使用 yum install nginx 这个指令去安装nginx,因为nginx这个服务不是yum库中自带的.图1是官方提供的大致安装步骤,图2是官网提供的多 ...

  6. CentOS7 yum安装、配置PostgreSQL 9.5

    PostgreSQL 9.5安装 1.添加RPM yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7 ...

  7. yum安装PostgreSQL 在6和7

    一.安装PostgreSQL 复制代码// 安装EPEL源# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.n ...

  8. CentOS7使用yum安装PostgreSQL和PostGIS

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

  9. CentOS下yum安装PostgreSQL

    关键词:centos install PostgreSQL Configure YUM repository vim /etc/yum.repos.d/CentOS-Base.repo [base] ...

随机推荐

  1. C# 中代码执行 ping 操作

    在代码中可以通过调用 System.Net.NetworkInformation 命名控件下的 Ping 类的 Send() 方法来实现,代码如下: var ping = new System.Net ...

  2. [译]Vulkan教程(21)顶点input描述

    [译]Vulkan教程(21)顶点input描述 Vertex input description 顶点input描述 Introduction 入门 In the next few chapters ...

  3. java之对象创建时各成员变量的初始值

    除了byte short int long float double char bollean这基础类型外,其余的都是引用类型 成员变量类型 初始值 byte 0 short 0 int 0 long ...

  4. [译]ASP.NET:WebForms vs MVC

    原文示例(VS2012): 1.  Download Simple WebForm demo - 6.7 KB 2.  Download Simple MVC Demo demo - 1.5 MB 介 ...

  5. .net core 中间件使用

    using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; usi ...

  6. js闭包理解案例-解决for循环为元素注册事件的问题

      转发自http://www.ruanyifeng.com/blog/2009/08/learning_javascript_closures.html       一.变量的作用域 要理解闭包,首 ...

  7. SpringCloud(六):服务网关zuul-API网关(服务降级和过滤)

    什么是API网关: 在微服务架构中,通常会有多个服务提供者.设想一个电商系统,可能会有商品.订单.支付.用户等多个类型的服务,而每个类型的服务数量也会随着整个系统体量的增大也会随之增长和变更.作为UI ...

  8. canvas之事件交互效果isPointPath

    isPointInPath() 用来检测某个点是否在当前路径中,常用来做点击交互等. 需要注意的是,每次执行一次beginPath方法,检测路径就变成这次beginPath之后绘制的路径,原来的路径不 ...

  9. JavaScript中的循环和闭包

    看一段比较经典的错误代码: // 希望获取页面上的所有div,在点击的时输出对应的编号 var oDom = document.querySelectorAll("div"); / ...

  10. SQL实用技巧:如何将表中某一列的部分数据合并到一行中

    select *,stuff(select ‘,’ + fieldname from table1 for xml path(”)),1,1,”)  as  field from table2 for ...