zoukankan      html  css  js  c++  java
  • CentOS7.6上安装PostgreSQL12.2

    CentOS7.6上安装PostgreSQL12.2

    摘要:

    操作系统:CentOS7.6

    数据库版本:PostgreSQL12.2

    安装方式:二进制rpm包安装

    1、PostgreSQL下载

    https://www.postgresql.org/

     

      

     

     

     

     

    2、上传安装包到服务器(rz工具)

    [root@centos7-6 ~]# mkdir /pg-rpm
    [root@centos7-6 ~]# rz
    rz waiting to receive.
    Starting zmodem transfer.  Press Ctrl+C to cancel.
    Transferring postgresql12-12.2-1PGDG.rhel7.x86_64.rpm...
      100%    2773 KB    2773 KB/sec    00:00:01       0 Errors  
    Transferring postgresql12-libs-12.2-1PGDG.rhel7.x86_64.rpm...
      100%     758 KB     758 KB/sec    00:00:01       0 Errors  
    Transferring postgresql12-server-12.2-1PGDG.rhel7.x86_64.rpm...
      100%   13275 KB    13275 KB/sec    00:00:01       0 Errors 
    [root@centos7-6 ~]# cd /pg-rpm/
    [root@centos7-6 pg-rpm]# ll -h
    total 17M
    -rw-r--r--. 1 root root 2.8M Apr  5 00:33 postgresql12-12.2-1PGDG.rhel7.x86_64.rpm
    -rw-r--r--. 1 root root 759K Apr  5 00:36 postgresql12-libs-12.2-1PGDG.rhel7.x86_64.rpm
    -rw-r--r--. 1 root root  13M Apr  5 00:41 postgresql12-server-12.2-1PGDG.rhel7.x86_64.rpm
    [root@centos7-6 pg-rpm]# 

    3、安装

    [root@centos7-6 pg-rpm]# rpm -ivh postgresql12-libs-12.2-1PGDG.rhel7.x86_64.rpm
    [root@centos7-6 pg-rpm]# rpm -ivh postgresql12-12.2-1PGDG.rhel7.x86_64.rpm 
    [root@centos7-6 pg-rpm]# rpm -ivh postgresql12-server-12.2-1PGDG.rhel7.x86_64.rpm

    4、初始化数据库并设置自启动

    4.1、通过systemctl管理数据库

    /usr/pgsql-12/bin/postgresql-12-setup initdb 
    systemctl enable postgresql-12
    systemctl start postgresql-12
    systemctl status postgresql-12

    4.2、通过PG自带的工具pg_ctl管理

    4.2.1、配置环境变量

    -bash-4.2$ pwd
    /var/lib/pgsql
    -bash-4.2$ 
    -bash-4.2$ vi .bash_profile
    #追加内容 export PATH
    =$PATH:/usr/pgsql-12/bin
    -bash-4.2$ source .bash_profile

     4.2.2、pg_ctl管理数据库

    [root@centos7-6 ~]# su - postgres
    -bash-4.2$ pg_ctl stop
    -bash-4.2$ pg_ctl start
    -bash-4.2$ pg_ctl status

    5、日志路径

     $PGDATA/log

  • 相关阅读:
    redis缓存和mysql数据库同步
    msf生成shellcode
    转 如何用mt7620方案的rt2860v2驱动实现wifi探针功能,网上能搜到一些方法,但是讲的好模糊?
    解决 “不支持尝试执行的操作”错误
    解决win7资源监视器不能开启
    mp3文件 ID3v2 帧标识的含义
    LoadImage函数问题
    AutoCAD ObjectARX(VC)开发基础与实例教程2014版光盘镜像
    Python计算文件MD5值
    objectARX 获取指定图层上所有实体ID
  • 原文地址:https://www.cnblogs.com/connected/p/12635653.html
Copyright © 2011-2022 走看看