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
欢迎各位转载,但必须在文章页面中给出作者和原文链接!