加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

CentOS 7 安装PostGIS

发布时间:2023-04-08 11:06:14 所属栏目:教程 来源:
导读:安装Postgresql 9.4

安装

yum install yum install postgresql94-server postgresql94-contrib service postgresql-9.4 initdb chkconfig postgresql-9.4 on

修改配置文件

查找pg_hba.conf文件并修改
安装Postgresql 9.4

安装

yum install  yum install postgresql94-server postgresql94-contrib service postgresql-9.4 initdb chkconfig postgresql-9.4 on

修改配置文件

查找pg_hba.conf文件并修改

  [root@localhost ~]# find / -name pg_hba.conf /var/lib/pgsql/9.4/data/pg_hba.conf [root@localhost ~]# vi /var/lib/pgsql/9.4/data/pg_hba.conf
 将下图对应位置改成红框内对应值 
CentOS 7 安装PostGIS

查找postgresql.conf

 [root@localhost ~]# find / -name postgresql.conf find / -name postgresql.conf [root@localhost ~]# vi /var/lib/pgsql/9.4/data/postgresql.conf
将监听的ip改为’*’,取消之前的#注释,注意要取消注释。

CentOS 7 安装PostGIS

修改环境变量

找到安装主目录

[root@localhost ~]# find / -name pgsql-9.4 /usr/pgsql-9.4

设置环境变量

[root@localhost ~]# vi /etc/profile

CentOS 7 安装PostGIS

重新启用profile文件,对更改生效。
source /etc/profile

关闭防火墙

systemctl stop firewalld.service systemctl disable firewalld.service

服务启动

pg_ctl restart #初始化启动了一次,所以是restart

账户登录

[root@localhost ~]# useradd postgres #新增postgres账户,已有的话,跳过本句,直接执行下一句设置密码 [root@localhost ~]# password 123456 #切换到postgres账户 [root@localhost ~]# su - postgres Last login: Mon Aug 10 10:45:32 CST 2015 on pts/0 #执行psql语句 -bash-4.2$ psql psql (9.4.4) Type "help" for help. postgres=# #这里输入psql命令

关于postgresql安装,其他系统参考这里

安装Postgis

安装postgis

yum install postgis2_94

如果出现以下情况

Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libcfitsio.so.0()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libspatialite.so.2()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libnetcdf.so.6()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libfreexl.so.1()(64bit) Error: Package: postgis2_93-client-2.1.1-1.rhel6.x86_64 (pgdg93) Requires: libjson.so.0()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libarmadillo.so.3()(64bit) Error: Package: postgis2_93-2.1.1-1.rhel6.x86_64 (pgdg93) Requires: hdf5 Error: Package: postgis2_93-2.1.1-1.rhel6.x86_64 (pgdg93) Requires: json-c Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libhdf5.so.6()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libdap.so.11()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libCharLS.so.1()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libdapserver.so.7()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libdapclient.so.3()(64bit) Error: Package: postgis2_93-2.1.1-1.rhel6.x86_64 (pgdg93) Requires: libjson.so.0()(64bit) Error: Package: gdal-libs-1.9.2-4.el6.x86_64 (pgdg93) Requires: libgta.so.0()(64bit)

然后重新安装postgis

yum install postgis2_94

 

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章