zoukankan      html  css  js  c++  java
  • postgresql安装

    1. 解压安装包

      # tar zxvf postgresql-12.4.tar.gz
      # cd postgresql-12.4
      
    2. 编译并安装

      # ./configure --prefix=/usr/local/postgresql
      # make
      # make install
      
    3. 新建并切换用户

      # addusr postgre
      # passwd postgre
      
    4. 修改目录权限

      # chown -R postgre:postgre /usr/local/postgresql
      
    5. 切换为postgre用户并修改环境变量

      # su - postgre
      # vim .bash_profile
      添加内容:
      PGHOME=/usr/local/postgresql
      export PGHOME
      
      PGDATA=/home/postgre/data/postgresql
      export PGDATA
      
      PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PGHOME/bin
      # source .bash_profile
      
    6. 初始化数据库

      # initdb
      # vim pg_hba.conf
      修改内容 IPv4 local connections:
      host    all             all             0.0.0.0/0               md5
      # vim postgresql.conf
      修改内容:
      listen_addresses = '*'
      
    7. 创建日志目录

      # mkdir -p /home/postgre/logs/postgresql
      # cd /home/postgre/logs/postgresql
      # touch pg_server.log
      
    8. 启动数据库

      # pg_ctl start -l /home/postgre/logs/postgresql/pg_server.log
      
    9. 查看是否启动

      # ps -ef |grep postgre
      
    10. 进入数据库(注意,默认的数据库名是postgres,如果不输入则默认为当前用户名,可能会提示数据库不存在)并修改密码

      # psql postgres
      # password
      查看数据库
      # l
      
    11. 添加系统服务,vim /etc/systemd/system/postgresql.service

      [Unit]
      Description=PostgreSQL database server
      After=network.target
       
      [Service]
      Type=forking
       
      User=postgre
      Group=postgre
       
      # Port number for server to listen on
      Environment=PGPORT=5432
       
      # Location of database directory
      Environment=PGDATA=/home/postgre/data/postgresql
       
      # Where to send early-startup messages from the server (before the logging
      # options of postgresql.conf take effect)
      # This is normally controlled by the global default set by systemd
      # StandardOutput=syslog
       
      # Disable OOM kill on the postmaster
      OOMScoreAdjust=-1000
       
      #ExecStartPre=/usr/local/pgsql9.4/bin/postgresql-check-db-dir ${PGDATA}
      ExecStart=/usr/local/postgresql/bin/pg_ctl start -l /home/postgre/logs/postgresql/pg_server.log -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
      ExecStop=/usr/local/postgresql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
       
      # Give a reasonable amount of time for the server to start up/shut down
      TimeoutSec=300
       
      [Install]
      WantedBy=multi-user.target
      
    12. 重新加载服务、启动、设置开机启动

      # systemctl daemon-reload
      # systemctl start postgresql.service
      # systemctl enable postgresql.service
      
  • 相关阅读:
    19-background
    18-超链接导航栏案例
    17-文本属性和字体属性
    16-margin的用法
    15-浮动
    14-块级元素和行内元素
    13-标准文档流
    12-简单认识下margin
    11-border(边框)
    10-padding(内边距)
  • 原文地址:https://www.cnblogs.com/ucfjepl/p/13840049.html
Copyright © 2011-2022 走看看