PostgreSQL 12 YUM安装
这篇文档,只是为了初次体验一下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安装的更多相关文章
- PostgreSQL 之 yum安装 postgis 插件
版本说明: CentOS7.5 + PostgreSQL 10.5 参考资源: https://www.postgresql.org/download/linux/redhat/ http://dow ...
- CentOS7 源码安装 PostgreSQL 12
PostgreSQL 12 源码安装 Table of Contents 1. 下载 2. 准备环境 3. 编译安装 4. 设置环境变量 5. 初始化数据库 6. 配置参数文件 6.1. postgr ...
- 与你相遇好幸运,CentOS 7 x86_64使用Yum安装PostgreSQL
访问http://yum.pgrpms.org/reporpms/repoview/letter_p.group.html,下载并安装和当前系统对应的rpm文件. wget https://downl ...
- postgresql数据库的yum安装方法
实验环境>>>>>>>>>>>>>>>>>>操作系统:CentOS release 6.3 ...
- CentOS 7 yum安装nginx-1.12.0
CentOS 7 中的 yum 没法直接使用 yum install nginx 这个指令去安装nginx,因为nginx这个服务不是yum库中自带的.图1是官方提供的大致安装步骤,图2是官网提供的多 ...
- CentOS7 yum安装、配置PostgreSQL 9.5
PostgreSQL 9.5安装 1.添加RPM yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7 ...
- yum安装PostgreSQL 在6和7
一.安装PostgreSQL 复制代码// 安装EPEL源# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.n ...
- CentOS7使用yum安装PostgreSQL和PostGIS
更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合Cent ...
- CentOS下yum安装PostgreSQL
关键词:centos install PostgreSQL Configure YUM repository vim /etc/yum.repos.d/CentOS-Base.repo [base] ...
随机推荐
- 安装CentOS 6.x报错"Disk sda contains BIOS RAID metadata"解决方法
今天在安装CentOS 6.2的时候,当进到检测硬盘的时候,总是过不去,报错如下: Disk sda contains BIOS RAID metadata, but is not part of a ...
- September 15th, 2019. Sunday, Week 38th.
Break down these walls and come on in. 一路披荆斩棘,勇往直前. We are the only wall that stands in our way to s ...
- pip命令详解
使用详解 1.pip安装软件 # pip install SomePackage 2.pip查看已安装的软件 # pip show --files SomePackage 3.pip检查哪些软件需要更 ...
- ubuntu下面安装nodejs
对于刚接触ubuntu的同学来说,一切都是新的,一切都是那么熟悉而又不熟悉的.不管是作为一个前端工程师还是一个后端工程师,我相信大家知道nodejs,但是如果希望自己能够在ubuntu上面使用node ...
- java8-新的日期API
背景 java的日期和时间API设计不理想,java8引入新的时间和日期API就是为了解决这个问题. 老的日期API的核心类 缺点 Date 月从0开始,年最小从1900年开始,没有时区的概念 Cal ...
- jvm虚拟机笔记<二> 垃圾回收与内存分配
确定对象已废弃需要两步: 利用可达性分析算法(与GC roots有关联——虚拟机栈中的对象,方法区静态对象,方法区常量对象,本地方法引用的对象)判断是否需要回收. 是否覆盖过finalize方法并执行 ...
- flex常见布局
一,常见圣杯布局 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> < ...
- Dojo.declare使用方法详解
ArcGIS API for JavaScript是基于dojo开发的一套API,在实际生产中,我们需要再根据自己的需求实现自定义的功能,最后抽象成接口给前端调用. 我们使用dojo的declare来 ...
- 【转载】作为Android开发者,你真的熟悉Activity吗?
学过android的人都知道,activity是最常用的四大组件之一,但你真的了解透彻activity了吗?接下来,本人将从activity的正常和异常生命周期.启动模式.IntentFilter匹配 ...
- Spring Boot 2 + jpa + mysql例子
Spring Data框架为数据访问提供了一个通用的模型,无论访问哪种数据库,都可以使用同样的方式,主要有以下几个功能:(1)提供数据与对象映射的抽象层,同一个对象,可以被映射为不同数据库的数据:(2 ...