zoukankan      html  css  js  c++  java
  • postgresql Centos7部署

    1、创建postgres用户组
    
    yum -y install libicu libxslt-devel
    useradd postgres
    echo 'postgres'|passwd --stdin postgres  //设置密码为postgres
    2、rpm安装
    rpm -ivh postgresql10-libs-10.15-1PGDG.rhel7.x86_64.rpm
    rpm -ivh postgresql10-10.15-1PGDG.rhel7.x86_64.rpm
    rpm -ivh postgresql10-server-10.15-1PGDG.rhel7.x86_64.rpm
    rpm -ivh postgresql10-contrib-10.15-1PGDG.rhel7.x86_64.rpm
    
    
    
    3、修改自定义数据目录
    # 使用root用户
    systemctl edit postgresql-10.service
    
    # 编辑内容
    [Service]
    Environment=PGDATA=/dbdata/postgresql/data
    # 自定义配置在/etc/systemd/system/postgresql-10.service.d/override.conf
    =====================================================================
    cat /etc/systemd/system/postgresql-10.service.d/override.conf
    
    4、重新加载系统
    systemctl daemon-reload
    
    5、设置目录权限
    chown postgres:postgres /dbdata/postgresql/data
    
    6、初始化pg
    /usr/pgsql-10/bin/postgresql-10-setup initdb
    
    7、设置开机启动pg
    systemctl enable postgresql-10.service
    systemctl start postgresql-10.service
    
    8、修改用户名密码
    su - postgres
    psql
    # 设置postgres用户密码
    ALTER USER postgres WITH PASSWORD 'postgres';
    #退出
    \q
    
    9、远程连接配置
    vi /dbdata/postgresql/data/pg_hba.conf
    添加:
    host all all 0.0.0.0/0 md5
    # 开启远程访问,修改postgresql.conf配置文件
    vi /dbdata/postgresql/data/postgresql.conf
    添加:
    listen_addresses='*'
    # 开放postgresql服务
    firewall-cmd –add-service=postgresql –permanent
    # 重载防火墙
    firewall-cmd –reload
    
    # 重启pg服务
    systemctl restart postgresql-10
    
    10、修改系统环境变量
    su - postgres
    vi .bash_profile
    PGDATA=/dbdata/postgresql/data/
    PGHOME=/usr/pgsql-10
    export PGDATA
    export PGHOME
    export PATH=$PATH:$PGHOME/bin
    
    # 生效
    source .bash_profile
    ########## 今天的苦逼是为了不这样一直苦逼下去!##########
  • 相关阅读:
    iphone自动识别电话以及变色的解决
    chrome浏览器模拟微信
    获取一个图片的真实宽高
    iview插件
    vue aixos请求json
    ajax请求文件流下载
    检测打开设备
    轮播图
    rem适配
    easyui月份插件如何监听
  • 原文地址:https://www.cnblogs.com/ruii/p/14452123.html
Copyright © 2011-2022 走看看