CentOS 7 安裝PostGIS

來源:互聯網
上載者:User

CentOS 7 安裝PostGIS
安裝Postgresql 9.4安裝

yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpmyum install postgresql94-server postgresql94-contribservice postgresql-9.4 initdbchkconfig 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
將對應位置改成紅框內對應值

尋找postgresql.conf
[root@localhost ~]#  find /  -name postgresql.conffind /  -name postgresql.conf[root@localhost ~]# vi /var/lib/pgsql/9.4/data/postgresql.conf

將監聽的ip改為’*’,取消之前的#注釋,注意要取消注釋。

修改環境變數

找到安裝主目錄

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

設定環境變數

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


重新啟用profile檔案,對更改生效。

source /etc/profile
關閉防火牆
systemctl stop firewalld.servicesystemctl disable firewalld.service
服務啟動
pg_ctl restart  #初始化啟動了一次,所以是restart
賬戶登入
[root@localhost ~]# useradd postgres #新增postgres賬戶,已有的話,跳過本句,直接執行下一句設定密碼[root@localhost ~]# password 123456#切換到postgres賬戶[root@localhost ~]# su - postgresLast login: Mon Aug 10 10:45:32 CST 2015 on pts/0#執行psql語句-bash-4.2$ psqlpsql (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: hdf5Error: Package: postgis2_93-2.1.1-1.rhel6.x86_64 (pgdg93)           Requires: json-cError: 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)

請先安裝以下rpm

#CentOS 7, RHEL 7 64-bit:sudo http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm# CentOS 6, RHEL 6 64-bit:sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm# CentOS 6, RHEL 6 32-bit:sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm# CentOS 5, RHEL 5 64-bit:sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm# CentOS 5, RHEL 5 32-bit:sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

然後重新安裝postgis

yum install postgis2_94

關於postgis其他版本安裝,請參考這裡

安裝pgrouting
yum install pgrouting_94

關於pgrouting的使用,請參考這裡

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.