zoukankan      html  css  js  c++  java
  • centos7安装postgresql和postgis

    1、安装步骤

    -- 安装对应的rpm文件(其他系统的rpm包,请自行到https://yum.postgresql.org/下载)
    yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

    -- 查询postgresql的版本

    yum search postgresql
    -- 安装对应的版本(我安装的是postgresql9.6+postgis2.4)
    yum -y install postgresql96.x86_64 postgresql96-server.x86_64 postgresql96-devel.x86_64
    -- 安装对应的postgis插件
    yum install postgis24_96.x86_64
    如果出现如下图所示错误,

    请执行如下命令:rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

    执行完毕后,继续执行yum install postgis24_96.x86_64

    至此整个安装过程完毕!

      2、初始化运行环境

    -- 初始化数据库
    /usr/pgsql-9.6/bin/postgresql96-setup initdb
    -- 启动psql服务器
    systemctl start postgresql-9.6
    --设置开机自启动
    systemctl enable postgresql-9.6
    --开发防火墙
    firewall-cmd--permanent --add-port=5432/tcp
    firewall-cmd--reload
    -- 修改pg_hba.conf和postgresql.conf
    /var/lib/pgsql/9.6/data/pg_hba.conf 将配置文件中记录的method的ident修改为trust(可以实现用户名和密码访问数据库)
    /var/lib/pgsql/9.6/data/postgresql.conf 修改listen_addresses = 'localhost'为listen_addresses= '*',允许所有远程访问
    (这样可以在其它客户机上远程登陆服务器,比如在windows机器上使用pgadmin客户端)

    -- 初始化数据库

    su postgresql

    --登录到数据库

    psql(可以默认登陆到用户名为:postgres 数据库名为postgres的数据库)

    --查看当前连接到的数据库

    c

    --查看当前的数据库信息

    l

    --查看当前数据库的表信息

    d

    --导入sql脚本

    第一种方法:i  sql脚本的路径信息 

    第二种:psql -U 用户 -d 数据库 -h 主机 -p 端口 -f 脚本路径

    至此基本的安装,初始化过程就结束了,  如果你在过程中有任何疑问,欢迎交流学习!

  • 相关阅读:
    IOS中的国际化的使用(Xcode 6.0之后的使用步骤)
    KVC,KVO的区别和使用
    通知,代理,block 单例的使用和区别
    NSoperation的使用
    多线程之Nsthread的使用方法
    多线程的之GCD的介绍
    IOS中生成证书、真机调试、上线发布程序的步骤
    IOS之NavigationController跳转到指点的界面
    IOS之截取字符串的使用方法
    ios 之定时器的使用的技巧(结合runloop)使用
  • 原文地址:https://www.cnblogs.com/ljy-20180122/p/12371929.html
Copyright © 2011-2022 走看看