Linux centos6.3 安装postgres9.2.4 postgis2.0.3
1. 安装postgres + postgis: [pgsql安装] tar xvzf postgresql-9.2.4.tar.gz cd postgresql-9.2.4 #./configure --prefix=/mapbar/app/pgsql make make install groupadd postgres useradd postgres -g postgres mkdir -p /mapbar/app/pgsql/data chown -R postgres /mapbar/app/pgsql/ su postgres #都需要使用这个登陆执行语句 # 初始化pgsql数据库 出现: Encoding "GB18030" is not allowed as a server-side encoding /mapbar/app/pgsql/bin/initdb -D /mapbar/app/pgsql/data --local=zh_CN.UTF8 vi /mapbar/app/pgsql/data/pg_hba.conf host all all 0.0.0.0/0 trust vi /mapbar/app/pgsql/data/postgresql.conf listen_addresses = '*' 手动启动: ( /mapbar/app/pgsql/bin/postgres -D /mapbar/app/pgsql/data) /mapbar/app/pgsql/bin/pg_ctl start -D /mapbar/app/pgsql/data/ root下: 1. 先安装Proj4和GEOS 1.1. 安装Proj-4.6.0 # tar zvxf proj-4.6.0.tar.gz # cd proj-4.6.0 # ./configure --prefix=/mapbar/app/proj4 # make # make install 1.2. 安装geos-3.4.2.tar.bz2 # tar jxvf geos-3.4.2.tar.bz2 # cd geos-3.4.2 # ./configure --prefix=/mapbar/app/geos3 # make # make install 1.3 tar xvzf gdal-1.9.2.tar.gz cd gdal-1.9.2 ./configure --prefix=/mapbar/app/gdal make make install 1.4 tar xvzf json-c-0.9.tar.gz cd json-c-0.9 ./configure --prefix=/mapbar/app/jsonc make make install 1.5 postgis-2.0.3 2. 安装ppostgis-2.0.3.tar.gz # tar xvzf postgis-2.0.3.tar.gz # cd postgis-2.0.3 # ./configure --prefix=/mapbar/app/postgis --with-pgconfig=/mapbar/app/pgsql/bin/pg_config --with-projdir=/mapbar/app/proj4 --with-geosconfig=/mapbar/app/geos3/bin/geos-config --with-gdalconfig=/mapbar/app/gdal/bin/gdal-config --with-jsondir=/mapbar/app/jsonc (设置安装位置为/opt/postgis,并且使用Proj4与GEOS3) # make # make install root 下: 增加动态链接库: vi /etc/ld.so.conf /mapbar/app/lib /mapbar/app/proj4/lib /mapbar/app/geos3/lib /mapbar/app/pgsql/lib 然后运行ldconfig使刚加入的库路径生效: # /sbin/ldconfig su postgres: /mapbar/app/pgsql/bin/createdb template_postgis_20 ****************************** createdb: could not connect to database postgres: could not connect to server: 没有那个文件或目录 Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 没启动服务的错 ****************************** /mapbar/app/pgsql/bin/createlang plpgsql template_postgis_20 su root: ln -sn /mapbar/app/geos3/lib/libgeos_c.so.1.8.2 /usr/lib64/libgeos_c.so.1 ln -sn /mapbar/app/jsonc/lib/libjson.so.0.0.1 /usr/lib64/libjson.so.0 ln -sn /mapbar/app/gdal/lib/libgdal.so.1.16.2 /usr/lib64/libgdal.so.1 ln -sn /mapbar/app/proj4/lib/libproj.so.0.5.4 /usr/lib64/libproj.so.0 su postgres: /mapbar/app/pgsql/bin/psql -d template_postgis_20 -f /mapbar/app/pgsql/share/contrib/postgis-2.0/postgis.sql /mapbar/app/pgsql/bin/psql -d template_postgis_20 -f /mapbar/app/pgsql/share/contrib/postgis-2.0/spatial_ref_sys.sql /mapbar/app/pgsql/bin/psql -d template_postgis_20 -f /mapbar/app/pgsql/share/contrib/postgis-2.0/postgis_upgrade_20_minor.sql 设置用户的密码: vi /mapbar/app/pgsql/data/pg_hba.conf host all all 0.0.0.0/0 password /mapbar/app/pgsql/bin/psql postgres alter user postgres with password '123456';
转载自:https://blog.csdn.net/iteye_494/article/details/82608346