CentOS7 安裝 PostGIS方法(適合國內網絡)


安裝Postgresql 9.4

yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
yum install postgresql94-server postgresql94-contrib
service postgresql-9.4 initdb
chkconfig postgresql-9.4 on

安裝Postgis

yum install postgis2_94

如果提示缺少一大堆依賴庫,則需要安裝對應源,

#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

這里網絡被牆,不能導入,改用阿里雲源(針對centos7

http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-6.noarch.rpm

安裝pgRouting

yum install pgrouting_94

初始化數據庫

CentOS 6.x 系統
service postgresql-9.4 initdb

CentOS 7 系統
/usr/pgsql-9.4/bin/postgresql94-setup initdb  

啟動服務並設置為開機啟動

CentOS 6.x 系統
service postgresql-9.4 start
chkconfig postgresql-9.4 on  

CentOS 7 系統
systemctl enable postgresql-9.4
systemctl start postgresql-9.4 Li

CentOS 6.x 系統

開放防火牆端口
vi /etc/sysconfig/iptables  
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT  

重啟防火牆服務
service iptables restart  

CentOS 7 系統

firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload  

設置postgres用戶密碼

postgres=# \password postgres  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM