首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

Centos6.3 上安装postgresql9.1.5和postgis1.5.5(左脑版)

2012-09-17 
Centos6.3 下安装postgresql9.1.5和postgis1.5.5(左脑版)2012年9.9日整理一下最新版本的安装,希望可以在此

Centos6.3 下安装postgresql9.1.5和postgis1.5.5(左脑版)

2012年9.9日整理一下最新版本的安装,希望可以在此记录下来,以后可以看看,

左脑:山西农业大学

 

1、安装centos6.3   desktop


2、卸载自带的openjdk
   java -vsesion
   rpm -qa | grep java
   rpm -e --nodeps   ..........


3、创建用户 postgres
# groupadd postgres
# useradd -g postgres postgres

 

4、安装proj包
#tar -zvxf proj-4.8.0.tar.gz
#cd proj-4.8.0
#./configure –prefix=/usr/local/proj
#make
#make install


5、安装geos包
#tar xvfj geos-3.2.3.tar.bz2
#cd geos-3.2.3
#./configure –prefix=/usr/local/geos(这里不需要再加其他参数,配置结果出现3个false,也不要紧)
#make
#make install


6、安装postgresql 包
#tar –zvxf postgresql-9.1.5.tar.gz
#cd postgresql-9.1.5
#./configure –prefix=/usr/local/pgsql
#make
#make install
这样在/usr/local就生成了个pgsql目录


7、添加环境变量
编辑 vi /etc/profile
PATH=$PATH:$HOME/bin
export PATH
PATH=$PATH:$HOME/bin
PGSQL_HOME=/usr/local/pgsql
PATH=$PATH:$PGSQL_HOME/bin
PROJ_HOME=/usr/local/proj
GEOS_HOME=/usr/local/geos
PATH=$PATH:$PROJ_HOME/bin:$GEOS_HOME/bin
LD_LIBRARY_PATH=$PGSQL_HOME/lib:$PROJ_HOME/lib:$GEOS_HOME/lib
export PATH
export PGSQL_HOME
export PROJ_HOME
export GEOS_HOME
export LD_LIBRARY_PATH


8、#mkdir /usr/local/pgsql/data
#cd  /usr/local
把pgsql目录交给postgres
#chown  -R postgres:postgres  pgsql
su - postgres
#initdb –D /usr/local/pgsql/data


9、配置pg_hba.conf、postgresql.conf
   在pg_hba.conf 后面加  host  all  all   192.168.56.0/24 trust
   将postgresql.conf文件中的#listen_address=’localhost’改为listen_address=’*’
   将postgresql.conf文件中的#port=5432改为port=5432


10、设置postgresql启动
    拷贝安装包下面的
    ..../contrib/start-scripts/linux 到/etc/init.d/ 目录下
   如: cp linux /etc/init.d/postgis
    chmod a+x /etc/init.d/postgis
    chown –R postgres:postgres /etc/init.d/postgis
这里也可以编辑这个启动文件,如配置各种路径。
最后将该项加入到系统启动里chkconfig --add postis


11、运行setup  在系统服务里确保postgis开机启动


12、安装postgis包
#tar -zvxf postgis-1.5.5.tar.gz
#cd postgis-1.5.5
#LDFLAGS=-lstdc++
#./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
#make
#make install


13、拷贝pgsql/share/contrib/postgis-1.5 到/home/postgres/下
14、重新启动系统
15、登陆系统
16、su - postgres
17、createdb  demogis
18、psql -d demogis -f postgis-1.5/postgis.sql
19、psql -d demogis -f postgis-1.5/spatial_ref_sys.sql
20、修改数据库用户密码

热点排行