postgresql与postgis 安装
- 格式:docx
- 大小:17.57 KB
- 文档页数:2
CentOS7使⽤yum安装PostgreSQL和PostGIS的⽅法1.更新yum源同时安装epel(Extra Packages for Enterprise Linux 7),为了稳定性,CentOS7的默认yum源缺少很多组件,这些组件可以在epel上找到。
命令:yum install -y https:///pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpmyum -y install epel-release2.安装PostgreSQL使⽤yum search postgre命令可以看到多个版本的PostgreSQL,这⾥我选择了PostgreSQL10。
yum install -y postgresql10-server postgresql10-contrib初始化/usr/pgsql-10/bin/postgresql10-setup initdb设置开机启动systemctl enable postgresql-10启动数据库systemctl start postgresql-103.配置数据库配置远程访问,编辑/var/lib/pgsql/10/data/postgresql.conf,找到listen_addresses,如果想对所有IP开放,把listen_addresses的值改为‘*',如果只对部分IP开放,多个IP之间⽤,(逗号加空格)隔开。
配置账户访问权限,编辑/var/lib/pgsql/10/data/pg_hba.conf,⽂件分为5列,分别是TYPE、DATABASE、USER、ADDRESS、METHOD,可以对不同IP地址的⽤户设置不同数据库的访问权限。
最后⼀列METHOD的解析如下:trust 任何连接都允许,不需要密码reject 拒绝符合条件(前⾯⼏个条件)的请求MD5 接收⼀个MD5加密过的密码password 接收⼀个密码来登陆,只在可信的⽹络使⽤这种⽅式gss 使⽤gssapi认证,只在tcp/ip连接可⽤sspi 只在windows可⽤的⼀种⽅式krb5 不常⽤,只在TCP/IP可⽤ident 使⽤操作系统⽤户名认证,验证它是否符合请求的的数据库⽤户名ldap 使⽤LDAP服务器认证cert 使⽤ssl客户端认证pam 使⽤操作系统的pam模块服务如果要求所有IP都是使⽤密码登录,则配置为host all all 0.0.0.0/0 md5。
详解Linux中PostgreSQL和PostGIS的安装和使⽤安装 PostgreSQL 和 PostGISPostgreSQL 和 PostGIS 已经是热门的开源⼯程,已经收录在各⼤ Linux 发⾏版的 yum 或 apt 包中。
Ubuntu 为例,安装以下包即可:$ sudo apt-get install postgresql-client postgresql postgis -yRedHat 系列则请安装:$ sudo yum install postgresql-server postgresql postgis初次安装后,默认⽣成⼀个名为 postgres 的数据库和⼀个名为 postgres 的数据库⽤户。
这⾥需要注意的是,同时还⽣成了⼀个名为 postgres 的 Linux 系统⽤户。
我们以后在操作 PostgreSQL 的时候都应该在这个新创建的 postgres ⽤户中进⾏。
PostgreSQL 配置如果是从源码安装不建议从源码安装,我曾经试过从源码安装,实在是太⿇烦了,⽽且各种 make install 容易出错。
最后我还是⽤ rpm 安装了。
不过既然花了些时间研究并且我成功安装过,所以还是记录⼀下吧——不过,可能有错漏,所以读者如果要从源码安装的话,请做好回滚的准备。
如果使⽤的是通过 source 编译并且 make install 安装,那么这⼀节是需要额外配置的。
貌似 CentOS 系列的安装也需要……默认的 make install 之后,PostgreSQL 安装⽬录在:/usr/local/pgsql/⾸先根据这个链接的参考,需要配置环境变量$ set $PGDATA = "/usr/local/pgsql/database"但是执⾏了 pg_ctl start 之后,会出现错误:pg_ctl: directory "/usr/local/pgsql/database" is not a database cluster directory这样的话,就需要参照 PostGreSQL 官⽅⽂档的步骤创建真正的 database:<br/>PostgreSQL: Documentation: 9.1: Creating a Database Cluster⾸先创建⼀个⽤户账户,名叫 postgres$ usradd postgres$ sudo chown postgres /usr/local/pgsql/database然后进⼊这个账户,创建 database$ sudo su postgres$ initdb -D /usr/local/pgsql/database/此时 shell 会输出:The files belonging to this database system will be owned by user "postgres".This user must also own the server process.The database cluster will be initialized with locale "C".The default database encoding has accordingly been set to "SQL_ASCII".The default text search configuration will be set to "english".Data page checksums are disabled.fixing permissions on existing directory /usr/local/pgsql/database ... okcreating subdirectories ... okselecting default max_connections (100)selecting default shared_buffers ... 128MBselecting dynamic shared memory implementation ... posixcreating configuration files ... okcreating template1 database in /usr/local/pgsql/database/base/1 ... okinitializing pg_authid ... okinitializing dependencies ... okcreating system views ... okloading system objects' descriptions ... okcreating collations ... okcreating conversions ... okcreating dictionaries ... oksetting privileges on built-in objects ... okcreating information schema ... okloading PL/pgSQL server-side language ... okvacuuming database template1 ... okcopying template1 to template0 ... okcopying template1 to postgres ... oksyncing data to disk ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success. You can now start the database server using:pg_ctl -D /usr/local/pgsql/database/ -l logfile start恭喜你,接下来就可以启动 PostgreSQL 了:pg_ctl -D /usr/local/pgsql/database/ -l /usr/local/pgsql/database/psql.log startPostgreSQL 安装好后进⼊ postgres 账户,并且进⼊ PostgreSQL 控制台:$ sudo su postgres$ psql这时相当于系统⽤户 postgres 以同名数据库⽤户的⾝份,登录数据库,否则我们每次执⾏ psql 的时候都要在参数中指定⽤户,容易忘。
PostGIS Tiger geocoder是一个用于地理编码和反向地理编码的插件,它基于美国TIGER数据集。
以下是使用PostGIS Tiger geocoder 的基本步骤:1. 安装PostgreSQL和PostGIS扩展:确保你已安装PostgreSQL 数据库和PostGIS扩展。
PostGIS是一个扩展包,提供了地理对象和几何类型的支持。
2. 下载TIGER数据:TIGER数据集是免费的,可以从美国地质调查局(USGS)网站下载。
选择适当的年份和区域的数据集。
3. 导入TIGER数据到PostGIS:使用`shp2pgsql`工具将TIGER 数据导入到PostgreSQL数据库中。
例如,将一个州的TIGER数据导入到一个名为`tiger`的schema中:```bashshp2pgsql -s 4326 -g the_geom <path_to_tiger_data.shp> tiger.tl_2018_xxxx```其中,`4326`是SRID代码,`the_geom`是几何列的名称,`<path_to_tiger_data.shp>`是TIGER数据的路径,`tiger.tl_2018_xxxx`是导入后的表名。
4. 配置PostGIS Tiger geocoder:在PostgreSQL中创建一个新的schema(如果尚未创建)来存储TIGER geocoder的数据表和函数。
5. 加载TIGER geocoder数据:运行以下SQL命令来加载TIGER geocoder数据:```sqlSELECT load_tiger_geocoder('<path_to_tiger_data_dir>');```其中,`<path_to_tiger_data_dir>`是包含TIGER数据的目录路径。
6. 使用TIGER geocoder:现在你可以使用TIGER geocoder进行地理编码和反向地理编码。
postgis使用手册一、PostGIS简介1.背景介绍PostGIS是一个开源的地理信息系统(GIS)扩展,用于PostgreSQL数据库。
它为数据库增添了地理空间处理能力,使得PostgreSQL成为一个功能强大的空间数据库。
2.功能特点PostGIS具有以下功能特点:(1)支持多种几何类型:点、线、面等。
(2)提供丰富的空间函数:几何运算、坐标转换、空间关系判断等。
(3)空间索引:提高空间查询性能。
(4)地理处理:支持地理数据的一系列操作,如几何形状的创建、修改、查询等。
二、安装与配置1.安装步骤(1)安装PostgreSQL数据库。
(2)下载并安装PostGIS。
(3)配置环境变量。
(4)启动PostgreSQL数据库。
2.配置方法(1)修改PostGIS配置文件。
(2)设置参数如:GEOS_INLINE_LIBRARY、GEOS_SHARED_LIBS等。
(3)重启PostgreSQL数据库。
三、基本操作1.数据库连接使用PostGIS需要先连接到PostgreSQL数据库。
可以使用编程语言(如Python、Java等)或图形界面工具(如pgAdmin、DBeaver等)进行连接。
2.几何类型PostGIS支持多种几何类型,如POINT(点)、LINESTRING(线)、POLYGON(面)等。
3.空间函数PostGIS提供丰富的空间函数,如ST_Intersects(判断两个几何对象是否相交)、ST_Within(判断一个几何对象是否在另一个几何对象内部)等。
4.空间索引空间索引可以提高空间查询性能。
创建空间索引的方法与创建普通索引类似,只需在CREATE INDEX语句中添加ST_Geometry列即可。
四、高级功能1.地理处理PostGIS支持地理处理,可以对地理数据进行创建、修改、查询等操作。
常用地理处理工具有:GEOSGeom、ST_GeomFromText等。
2.地理数据处理PostGIS提供了一系列地理数据处理功能,如投影转换、坐标系转换等。
安装postgresql + proj + geos + postgis 环境centos 5.4 / 5.5安装包:1)、postgresql-8.4.13.tar.gz2)、proj-4.7.0.tar.gz3)、geos-3.2.3.tar.bz24)、postgis-1.5.1.tar.gz把这几个文件上传到/root目录下1、新建个用户组,及用户# groupadd postgres# useradd postgres# passwd postgres//设置密码为postgres2、安装上面的几个安装包1)安装postgresql包#tar –zvxf postgresql-8.4.13.tar.gz#cd postgresql-8.4.13#./configure –prefix=/usr/local/pgsql#make#make install这样在/usr/local就生成了个pgsql目录继续#mkdir /usr/local/pgsql/data#cd/usr/local把pgsql目录交给postgres#chown-R postgres:postgres pgsql postgressql初始化#su postgres#cd /usr/local/pgsql/bin#./initdb –D /usr/local/pgsql/data配置postgresql文件#vi /usr/local/pgsql/data/pg_hba.conf在最后面加上host all all 192.168.10.1/24 md5//加这个行表示192.168.10.*的用户必须以密码方式登录#vi /usr/local/pgsql/data/postgresql.conf找到#listen_address=’localhost’修改为listen_address=’*’修改#port=5432为port=5432修改#password=on 为password=on这样就Ok了下面开始设置用service postgresql start启动(如果没有的话,必须跳到目录启动)#cd /root/postgresql-8.4.13/contrib/start-scripts#cp linux /etc/init.d/#chmod a+x /etc/init.d/postgresql#chown –R postgres:postgres /etc/init.d/postgresql#vim /etc/profile加入下面几句export PGSQL_HOME =/usr/local/pgsqlexport PATH=$PATH:$PGSQL_HOME/binexport PROJ_HOME=/usr/local/projexport GEOS_HOME=/usr/local/geosexport LD_LIBRARY_PATH =$PGSQL_HOME/bin:$PROJ_HOME/bin:$GEOS_HOME/bin2)安装proj包#tar -zvxf proj-4.7.0.tar.gz#cd proj-4.7.0#./configure –prefix=/usr/local/proj#make#make install3)安装geos包#tar xvfj geos-3.2.3.tar.bz2#cd geos-3.2.3#./configure –prefix=/usr/local/geos#make#make install*注意如果coufigure出现g++not found就必须安装g++连网情况下可以yum install g++如果没有连网,可以先查下系统gcc的版本#rpm –qa | grep gcc然后去下载gcc-c++安装包4)、安装postgis包#tar -zvxf postgis-1.5.1.tar.gz#cd postgis-1.5.1#./configure--prefix=/usr/local/postgis--with-pgconfig=/usr/local/pgsql/bin/pg_config--with-projdir=/usr/local/proj--with-geosconfig=/usr/local/geos/bin/geos-config*注意configure成功时会出现Geos config : /usr/local/Postgresql configProj4Libxml2 config等字样然后接着往下(postgis编译过程中出错configure: error: could not find xml2-config from libxml2 within the current path. You may need to try re-running configurewith a --with-xml2config parameter)就是缺少libxml2rpm -ivh zlib-devel-1.2.3-25.el6.i686.rpmrpm -ivh libxml2-devel-2.7.6-1.el6.i686.rpm#make#make install成功之后在/usr/local/pgsql/share/contrib/postgis-1.5重启电脑#service iptables stop#su postgres#service postgresql startstart ok#createdb postgis#psql postgispostgis#=alter u ser postgres with password ‘postgres’; postgis#=\q5)新建个模版#createdb template_postgis#createlang plpgsql template_postgis#cd /usr/local/pgsql/share/contrib/postgis-1.5#psql –d template_postgis –f postgis.sql#psql –d template_postgis –f spatial_ref_sys.sql。
postgis使用手册一、概述1.PostGIS 简介PostGIS 是一个开源的地理信息系统(GIS)扩展,用于PostgreSQL 数据库。
它为数据库中的空间数据提供了丰富的功能,使得PostgreSQL 成为一个强大的空间数据管理系统。
PostGIS 遵循Open Geospatial Consortium (OGC)的简单要素规范,支持多种空间数据格式,如Shapefile、GeoJSON、KML 等。
2.安装与配置在安装PostGIS 之前,确保已安装PostgreSQL 数据库。
然后,按照PostGIS 官方网站的指引进行安装。
安装完成后,需要对PostGIS 进行配置。
在PostgreSQL 配置文件(如postgresql.conf)中添加以下内容:```shared_preload_libraries = "pg_gis"geometry_column_server = "YES"```重启PostgreSQL 服务器,完成安装与配置。
二、PostGIS 基础1.空间数据类型PostGIS 提供了多种空间数据类型,如POINT、LINESTRING、POLYGON 等。
这些数据类型用于存储几何图形,并支持各种空间函数与操作。
2.空间函数与操作PostGIS 提供了丰富的空间函数,如ST_Intersection、ST_Union、ST_Difference 等。
这些函数可用于计算几何图形的交集、并集、差集等。
此外,还可以使用ST_GeomFromText() 函数将地理标记语言(如WKT)转换为几何图形。
三、数据操作与管理1.空间数据的插入与查询可以使用INSERT INTO 语句将空间数据插入到表中。
例如:```INSERT INTO my_table (id, name, geometry)VALUES (1, "point", ST_GeomFromText("POINT(1 2)"));```查询空间数据时,可以使用ST_Intersects、ST_Within 等函数。
制作PostgreSQL及Postgis过程大概步骤汇总1.在HP服务器上创建一个postgres用户2.从HP网站下载一个GCC安装包及其相关的依赖包,并安装之。
3.从GCC网站下载一个GCC源代码包,并使用安装版GCC对其进行完整的编译。
4.下载PostgreSQL源代码包,并使用编译版GCC对其编译。
5.下载GEOS源代码包,并使用编译版GCC对其编译。
6.下载Postgis源代码包,并使用编译版GCC对其编译。
7.使用Postgis创建模版数据库。
当前使用的包下载位置:1.HP网站提供的GCC安装包及其依赖包:/,在此网站里输入包名进行包查找。
主要包括:(1)make包:/hppd/hpux/Gnu/make-3.81/(2)zlib包:/hppd/hpux/Misc/zlib-1.2.3/(3)gettext包:/hppd/hpux/Gnu/gettext-0.17/(4)libiconv包:/hppd/hpux/Development/Libraries/libiconv-1.12/ (5)bash包:/hppd/hpux/Shells/bash-3.2/(6)flex包:/hppd/hpux/Gnu/flex-2.5.35/(7)readline包:/hppd/hpux/Gnu/readline-5.2/(8)libgcc包:/hppd/hpux/Gnu/libgcc-4.2.3/(9)gcc包:/hppd/hpux/Gnu/gcc-4.2.3/安装方法使用:swinstall -x ask=true -s /xx/xx/xxx.deport (/xx/xx/xxx.deport,是指绝对路径下的包文件名字)2.GCC网站提供的GCC源代码包:/,在此网站里点击右边的”Download”->” M irror sites”找链接进行下载。
3.PostgreSQL源代码包:/download/4.GEOS源代码包:/5.Postgis源代码包:/download/本文档中的引用的绝对路径1.gcc源程序包解开路径:/opt/jm/temp/gcc-4.2.32.gcc源程序编译之后安装路径:/opt/jm/gcc3.PostgreSQL源程序包解开路径:/opt/jm/pgsrc/postgresql-8.3.14.PostgreSQL源程序编译之后安装路径:/opt/jm/pgsql5.GEOS源程序包解开路径:/opt/jm/pgsrc/geos-3.0.06.GEOS源程序编译之后安装路径:/opt/jm/pgsql7.Postgis源程序包解开路径:/opt/jm/pgsrc/8.Postgis源程序编译之后安装路径:/opt/jm/pgsql在HP服务器上创建一个postgres用户1.用sam工具或useradd命令创建好一个用户,为了将来使用PostgreSQL和Postgis,因此,创建的用户名字就叫做postgres,密码也是postgres。
aix下postgresql及postgis的安装和配置1 系统aix 5.3.02 软件准备postgresql-8.2.5.tar.gzpostgis-1.1.5.tar.gzgcc-4.0.0-1.aix5.3.ppc.rpmlibgcc-4.0.0-1.aix5.3.ppc.rpmreadline-4.3-2.aix5.1.ppc.rpmreadline-devel-4.3-2.aix5.1.ppc.rpmzlib-1.2.3-3.aix5.1.ppc.rpmzlib-devel-1.2.3-3.aix5.1.ppc.rpmmake-3.80-1.aix5.1.ppc.rpm(gmake)flex-2.5.4a-6.aix4.3.ppc.rpm下面的包是系统默认的:cdrecord-1.9-6mkisofs-1.13-4AIX-rpm-5.3.0.30-1openssl-0.9.7g-2tcl-8.3.3-8tk-8.3.3-8expect-5.34-8conserver-8.1.7-2openCIMOM-0.8-1expat-1.95.7-1expat-devel-1.95.7-1openssl-devel-0.9.7g-2apache-1.3.31-1sslmod_ssl-2.8.19-1sslapache-devel-1.3.31-1sslbinutils-2.14-33 安装3.1 postgresql-8.2.5安装a)解压postgresql-8.2.5.tar.gzgunzip postgresql-8.2.5.tar.gztar xvf postgresql-8.2.5.tarb)进入postgresql-8.2.5目录配置:./configure --prefix=/dbdir/ 假定数据库的安装目录在是dbdir目录下。
编译:gmake安装:gmake install安装dblink:进入到postgresql-8.2.5/contrib/dblink目录下直接编译安装:gmakegmake install数据库安装结束3.2 postgis-1.1.5.tar.gz安装a)先解压目录:gunzip postgis-1.1.5.tar.gztar xvf postgis-1.1.5.tarb)进入postgis-1.1.5目录先配置安装环境:./configure --with-pgsql=/dbdir/bin/pg_config这步执行完毕后会生成一个Makefile.config文件,修改该文件添加手动指定的命令及选项,添加内容如下:AR=/opt/freeware/bin/arAROPT=rsRANLIB=/opt/freeware/bin/granlibMKLDEXPORT=/dir/postgresql-8.2.5/src/backend/port/aix/mkldexport.sh修改完毕后,再进入到postgis-1.1.5/lwgeom目录下,修改Makefile.shlib文件,手动指定文件的目录及文件:#$(COMPILER) $(LDFLAGS_SL) -o $@ $< $(LDFLAGS) $(SHLIB_LINK) -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP) -Wl, -bE:lib$(NAME)$(EXPSUFF)$(COMPILER) $(LDFLAGS_SL) -lm -o $@ $< $(LDFLAGS) $(SHLIB_LINK) -Wl,-bI:/dir/postgresql-8.2.5/src/backend/postgres.imp -Wl, -bE:lib$(NAME)$(EXPSUFF)修改完毕后,切换到上一级目录。
PostGIS 是一个开源的PostgreSQL 扩展,它为PostgreSQL 数据库添加了地理对象支持,使得PostgreSQL 成为一个强大的地理信息系统(GIS)数据库。
以下是PostGIS 使用手册的简要概述:1. 安装与配置:* 确保已安装PostgreSQL 数据库。
* 在PostgreSQL 中安装PostGIS 扩展。
可以通过包管理器(如apt、yum)或直接从PostGIS 官网下载安装包进行安装。
* 在PostgreSQL 中创建一个新的GIS 数据库或选择一个已存在的数据库,并启用PostGIS 扩展。
2. 创建GIS 表:* 使用`CREATE TABLE` 语句创建GIS 表,例如:```sql`CREATE TABLE spatial_table (id SERIAL PRIMARY KEY,name VARCHAR(100),geom GEOMETRY(Point, 4326));````* 在上述示例中,创建了一个名为`spatial_table` 的表,包含一个自增的`id` 主键、一个`name` 字符串字段和一个`geom` 点类型的几何字段。
3. 插入GIS 数据:* 使用`INSERT INTO` 语句插入GIS 数据,例如:```sql`INSERT INTO spatial_table (name, geom)VALUES ('Point A', ST_GeomFromText('POINT(1 1)', 4326));````* 在上述示例中,向`spatial_table` 表中插入了一行数据,包含一个名为`Point A` 的点和对应的几何坐标`(1, 1)`。
4. 查询GIS 数据:* 使用SQL 查询语句对GIS 表进行查询,例如:```sql`SELECT * FROM spatial_table WHERE ST_DWithin(geom, ST_GeomFromText('POINT(1 1)', 4326), 0.01);````* 在上述示例中,查询了与点`(1, 1)` 距离在0.01以内的所有点。
安装过程第一步:点击Next。
第二步:更改安装目录,一般安装在C盘默认目录下,点击Next。
第三步:更改数据库中数据库数据的安装目录,一般选择默认安装在C盘,点击Next。
第四步:输入数据库的密码,并且确认,我这里输入123456。
第五步:选择数据库的端口,这里为5432,不要改它。
点击Next。
第六步:选择语言,就选Chinese,Singapore吧,我一般都选这个,没出过问题。
点击Next。
第七步:准备安装,点击Next。
第八步:安装进行时。
第九步:安装完成,提示安装远程服务器工具,不需要。
取消打勾以后点击Finish。
第十步:安装完PostgreSQL以后,安装PostGIS,我原来用这两个版本搭的,现在出2.0.2,我们用的这个版本是1.5.3的,用着还成,就用这个版本吧。
点I Agress。
第十一步:默认,点Next。
第十二步:选择安装目录,注意要选在PostgreSQL的安装目录下。
第十三步:PostgreSQL的用户名一般为postgres,密码为我们刚才输入的密码,123456,点击Next。
第十四步:PostGIS会自己建一个数据库,名字为postgis,这里我们默认就行。
点击Install。
第十五步:安装进行时。
中间提醒安装shp2pgsql插件,这是个把空间数据导入数据库的图形界面操作的插件,我们安装它。
也可以从cmd中用shp2pgsql 命令导入,还是有差别的。
选择是。
第十六步:安装完成,点击Close,关闭。
打开界面操作器,可以自己新建服务器,也可以打开原来的服务器,我们在默认的服务器postgres中输入密码123456,就可以建表了。
服务器可以自己建立。
1. requirement: gcc, zlib-devel, readline-devel.x86_64
2. ./configure --prefix=/usr/local/postgresql9.2
3. make/ make install
4. root access: /sbin/ldconfig /usr/local/postgresql9.2/lib
5. root access: vi /etc/profile , change:
PATH=/usr/local/postgresql9.2/bin:$PATH
export PATH
6. mkdir /usr/local/postgresql9.2/data
7. initdb -D /usr/local/postgresql9.2/data
8. vi /usr/local/postgresql9.2/data/postgresql.conf change listener and port
9. vi /usr/local/postgresql9.2/data/pg_hba.conf change connection
10. go back to source, cd sourcedir/contrib/start-scripts
cp linux postgresql
vi postgresql
init the prefix, PGDATA, PATH param.
11.cp this script into /etc/init.d, chmod execute to postgres
12. chkconfig --add postgresql
13. /etc/init.d/postgressql start|stop|status
14. alter user postgres with password 'new password';
postgis
1. wget /postgis/source/postgis-
2.0.
3.tar.gz
2. ./configure --prefix=/usr/local/postgresql9.2 , will found error, please install the dependency refer the blow.
3. install dependency package:
3.1 install libxml2
官网: wget
wget ftp:///libxml2/libxml2-2.9.1.tar.gz
./configure --prefix=/usr/local/pgtools/libxml2/ make make install
libxml2安装中出现的错误:
cannot remove `libtoolT': No such file or directory
解决方法:修改configure文件$ vi configure 删除这一行: $RM "$cfgfile" 重新再运行$ ./configure
3.2 install geos
官网: /geos/
wget /geos/geos-3.3.8.tar.bz2
./configure --prefix=/usr/local/pgtools/geos3.3.8
make make install (need gcc ,gcc-c++ component.)
3.3 install json-c
官网: /json-c/
wget /json-c/json-c-0.9.tar.gz
./configure --prefix=/usr/local/pgtools/json-c-0.9
make make install
3.4 install proj
官网: h ttp:///proj/
wget /proj/proj-4.8.0.tar.gz
./configure --prefix=/usr/local/pgtools/proj4.8.0
make make install
3.5 install GDAL
官网:/gdal/wiki/DownloadSource
wget /gdal/1.10.0/gdal-1.10.0.tar.gz
./configure --prefix=/usr/local/pgtools/gdal-1.10.0
make make install
5. 安装postgis
./configure --prefix=/usr/local/postgresql9.2/ --with-xml2config=/usr/local/pgtools/libxml2/bin/xml2-config --with-geosconfig=/usr/local/pgtools/geos3.3.8/bin/geos-config --with-projdir=/usr/local/pgtools/proj4.8.0/ --with-gdalconfig=/usr/local/pgtools/gdal-1.10.0/bin/gdal-config
--with-jsondir=/usr/local/pgtools/json-c-0.9
如果遇到checking for library containing GDALAllRegister… no
configure: error: could not find gdal的问题:
使用root: 在/etc/ld.so.conf.d里面,添加个文件, vi postgis.conf,内容为:
然后再执行ldconfig 重新make postgis就可以了
安装成功后,如果在create extension postgis中遇到could not load library /usr/local/postgresql9.2/lib/postgis-2.0.so: xxxx.so 的问题,
使用root: 在/etc/ld.so.conf.d里面,修改postgis.conf,内容为:
然后再执行ldconfig。