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

  • 相关阅读:
    Excel-单条件和多条件匹配搜索
    Excel-条件判断
    Excel-常用快捷键
    EXCEL-批量下拉填充
    Excel-数据分列的多种方法实现
    Excel-统一小括号格式(中文小括号,英文小括号)
    在WEB网页上模拟人的操作(批量操作)
    EXCEL-常用函数总结
    C语言学习——bsmap-2.74_main.cpp
    Linux --- awk
  • 原文地址:https://www.cnblogs.com/connected/p/12635653.html
Copyright © 2011-2022 走看看