这篇文档,只是为了初次体验一下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. 拷贝本地文件到docker容器内部

    #复制本地目录的xxx到镜像内部并且为xxx docker cp /home/xxx targetImage:/home/xxx

  2. [日常] linux设置环境变量

    比如首先在/etc/profile里面增加这几个环境变量 export PATH=$PATH:/mnt/f/ubuntu/goProject/go/binexport GOROOT=/mnt/f/ub ...

  3. nginx 修改文件上传大小限制

    修改nginx的配置文件,添加client_max_body_size 字段 注:client_max_body_size 必须要放在server下的server_name下,而不是放在locatio ...

  4. excel提取一类具有相似结构的部分数据,2种方式;数据——分列——分割符号/固定宽度;

    1.数据如同下图,这里我们需要提取 ¥...¥,也就是2¥及其中的内容: 鼠标选种某条数据,然后按Ctrl+A,则选种需要的所有数据:点击数据——分列:  2.根据分割符号分列:  3.选择合适的分隔 ...

  5. Java.awt.geom.AffineTransform 的使用

    https://docs.oracle.com/javase/8/docs/api/java/awt/geom/AffineTransform.html http://www.cjsdn.net/Do ...

  6. 14. Go 语言编译与工具

    Go 语言编译与工具 Go 语言的工具链非常丰富,从获取源码.编译.文档.测试.性能分析,到源码格式化.源码提示.重构工具等应有尽有. 在 Go 语言中可以使用测试框架编写单元测试,使用统一的命令行即 ...

  7. js中触发表单提交

    html代码: <form action="/test/action" method="get" id="myForm"> &l ...

  8. 安装PS

    1:下载溜云库 2:查找PS软件,下载 3:按照教程安装

  9. Java基础(七)

    左连接,右连接,内连接,全连接的区别 左连接:返回左表所有行,右表没有匹配行则返回null 右连接:返回右表所有行,左表没有匹配行则返回null 内连接:返回左右表共有行 全连接:返回左右表所有行,无 ...

  10. SpringCloud中Feign的适配器的实现方案

    前言 最近在做微服务的项目,各个系统之间需要进行调用,然后用一个适配器来实现服务之间的feign调用,使用适配器进行统一管理. 实现方案 首先我们需要将服务的名称进行单独的配置,可以方便的进行切换和扩 ...