re[postgis-users] solved - more centos install troubles
Stephen Woodbridge
woodbri at swoodbridge.com
Wed May 20 19:29:07 PDT 2009
Paul,
You can simplify a lot od the install issues by doing:
sudo yum groupinstall "Development Tools"
I also wanted to install a newer version of postgresql and postgis. This
is how I did it on a i386 box but I think you should be able to do the
equivalent on x86_64 box:
wget
ftp://ftp.pbone.net/mirror/ftp.postgresql.org/pub/binary/v8.2.13/linux/rpms/redhat/rhel-5-i386/postgresql-libs-8.2.13-1PGDG.rhel5.i386.rpm
wget
ftp://ftp.pbone.net/mirror/ftp.postgresql.org/pub/binary/v8.2.13/linux/rpms/redhat/rhel-5-i386/postgresql-server-8.2.13-1PGDG.rhel5.i386.rpm
wget
ftp://ftp.pbone.net/mirror/ftp.postgresql.org/pub/binary/v8.2.13/linux/rpms/redhat/rhel-5-i386/postgresql-devel-8.2.13-1PGDG.rhel5.i386.rpm
wget
//ftp.pbone.net/mirror/ftp.postgresql.org/pub/binary/v8.2.13/linux/rpms/redhat/rhel-5-i386/postgresql-8.2.13-1PGDG.rhel5.i386.rpm
wget
ftp://ftp.pbone.net/mirror/ftp.postgresql.org/pub/binary/v8.2.13/linux/rpms/redhat/rhel-5-i386/postgresql-8.2.13-1PGDG.rhel5.i386.rpm
# the following two are broken, see below, I downloaded the source
# and rebuilt if here, installed and that seemed to fix things.
#
#wget
ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/postgis/postgis-1.3.2-1.el5.rf.i386.rpm
#wget
ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/postgis/postgis-utils-1.3.2-1.el5.rf.i386.rpm
sudo /etc/init.d/postgresql stop
sudo rpm -i postgresql-libs-8.2.13-1PGDG.rhel5.i386.rpm
sudo rpm -i --force postgresql-libs-8.2.13-1PGDG.rhel5.i386.rpm
sudo rpm -i postgresql-server-8.2.13-1PGDG.rhel5.i386.rpm \
postgresql-8.2.13-1PGDG.rhel5.i386.rpm \
postgresql-devel-8.2.13-1PGDG.rhel5.i386.rpm
wget
ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/geos/geos-3.0.0-1.el5.rf.i386.rpm
wget
ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/geos/geos-devel-3.0.0-1.el5.rf.i386.rpm
wget
ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/proj/proj-4.5.0-1.el5.rf.i386.rpm
wget
ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/proj/proj-devel-4.5.0-1.el5.rf.i386.rpm
wget
ftp://ftp.pbone.net/mirror/dries.studentenweb.org/apt/redhat/el5/en/i386/RPMS.dries/proj-nad-4.5.0-1.el5.rf.i386.rpm
sudo rpm -i geos-3.0.0-1.el5.rf.i386.rpm \
geos-devel-3.0.0-1.el5.rf.i386.rpm \
proj-4.5.0-1.el5.rf.i386.rpm \
proj-nad-4.5.0-1.el5.rf.i386.rpm \
proj-devel-4.5.0-1.el5.rf.i386.rpm
# this one is a bad rpm, we will build from source
#sudo rpm -i postgis-1.3.2-1.el5.rf.i386.rpm
sudo yum install rpm-build byacc
wget
http://download.fedora.redhat.com/pub/epel/5/SRPMS/postgis-1.3.2-1.el5.src.rpm
sudo rpmbuild --rebuild postgis-1.3.2-1.el5.src.rpm
sudo yum remove postgis
sudo rpm -i /usr/src/redhat/RPMS/i386/postgis-1.3.2-1.i386.rpm
# move our working db into the proper location so it will be used
# as the default data directory when postgresql starts
sudo mv /var/lib/pgsql/data /var/lib/pgsql/data-old
sudo mv /usr/local/pgsql/data /var/lib/pgsql/data
sudo /sbin/service postgresql initdb
sudo vi /var/lib/pgsql/data/pg_hba.conf
sudo vi /var/lib/pgsql/data/postgresql.conf
sudo /sbin/chkconfig --add postgresql
sudo /sbin/chkconfig postgresql on
sudo /etc/init.d/postgresql start
#### optinally on a new database do:
createlang -U postgres plpgsql template1
createdb -U postgres -T template1 template_postgis
psql -U postgres -f /usr/share/pgsql/contrib/lwpostgis.sql template_postgis
psql -U postgres -f /usr/share/pgsql/contrib/spatial_ref_sys.sql
template_postgis
I will check out http://yum.pgsqlrpms.org/ which looks to be a good
find. I hope the above will help someone. I keeps every thing built and
managed with rpms.
Regards,
-Steve
Paul McCullough wrote:
> All,
>
> Thanks to your help, I was able to get everything installed.
>
> One of the key steps was to use pgsqlrpms rather than centos:
> http://yum.pgsqlrpms.org/howtoyum.php
>
> This was also a helpful page:
>
> http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html
>
> Finally, I include my (internal) wiki notes.
> Sorry about the missing formatting.
>
> Cheers!
> Paul
>
>
> /////////////////////////
>
>
> Introduction
>
> Do this slowly and carefully, and if your lucky, you won't get hurt.
>
>
> keywords
>
> Fedora 8
> Fedora 9
> centos
> proj.4
> geos
> postgis
> postgresql
>
> [edit] one - install proj4 (projection library)
>
>>From http://trac.osgeo.org/proj/, download and install the the PROJ4
> projection library source.
>
>
> $ cd /tmp
> $ wget http://download.osgeo.org/proj/proj-4.6.1.tar.gz
> $ tar xvfz proj-4.6.1.tar.gz
> $ cd proj-4.6.0
> $ ./configure
>
> If you are on a fresh system, you may see a number errors such as
>
> * "C preprocessor "/lib/cpp" fails sanity check"
> * no compiler found
> * etc
>
> If so, you need to fiddle a bit.
> Here is some of the buckshot I used; sometimes reapeating yum installs.
> I'm just a hacker; you are welcome to do correctly and edit this doc.
>
>
>> yum install gcc
>> yum groupinstall "Development Libraries"
>> yum install glibc-headers glibc glibc-commonglibc-devel
>> yum update glibc glibc-common glibc-headers glibc-devel
>
> then proceed...
>
>
> $ make
> $ su
> $ make install
> $ exit
>
> Odd as though it may sound, "make" may not have been installed.
>
>
> $ yum install make
>
> Lather, rinse, repeat.
>
>
> You should eventually see no errors and no dependency check failures.
> [edit] two - install GEOS (C++ port of the Java Topology Suite)
>
>
> $ bunzip2 geos-3.0.0.tar.bz2
> $ tar xvf geos-3.0.0.tar
> $ cd geos-3.0.0
> $ ./configure
> $ make
> $ su
> $ make install
> $ exit
>
> ON centos, when I issued the make command I saw this:
>
> ../../../libtool: line 1223: g++: command not found
>
> The googles suggested
>
> yum install gcc-c++
>
> which worked first time.
>
> If the output from "make install" included the following
>
> ----------------------------------------------------------------------
> Libraries have been installed in:
> /usr/local/lib
>
> If you ever happen to want to link against installed libraries
> in a given directory, LIBDIR, you must either use libtool, and
> specify the full pathname of the library, or use the `-LLIBDIR'
> flag during linking and do at least one of the following:
> - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
> during execution
> - add LIBDIR to the `LD_RUN_PATH' environment variable
> during linking
> - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
> - have your system administrator add LIBDIR to `/etc/ld.so.conf'
>
> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> ----------------------------------------------------------------------
>
> you need to do this:
>
> echo '/usr/local/lib' >> /etc/ld.so.conf.d/local-lib.conf
> ldconfig
>
> [edit] three - install PostGIS
>
> In order to build postGIS you need some artifacts from the postgresQL
> development package. This is not as straight forward as it should be.
> I encourage you to take a few minutes to read this through. First, your
> "disto repository" is not likely to be up to date with respect to postgresql
> packages. In other words, if you blindly type "yum install
> postgresql-devel", you may have trouble getting everything installed
> properly. I've seen errors regarding missing libraries and the like. To
> avoid the fuss, when you are installing postgresql packages, use the
> postgresql repositories instead of your ditsro repsository.
>
>
> Here is how you do that. You should read this from top to bottom.
>
> http://yum.pgsqlrpms.org/howtoyum.php
>
> Also read this; you can safley skip sections on this page.
>
>
> http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html
>
>
> Did you do your reading?
>
>
> OK, now we build postGIS.
>
>
> $ yum install postgresql-devel
> $ tar xvfz postgis-1.3.1.tar.gz
> $ cd postgis-1.3.1
> $ ./configure --with-pgsql=/usr/bin/pg_config
> --with-geos=/usr/local/bin/geos-config --with-proj=/usr/local
> $ make
> $ su
> $ make install
> $ exit
>
> Errors I've seen: error
>
> configure: error: Can't find 'flex'
>
> solution
>
> yum install flex
>
> [edit] four - make a database
>
>
> $ su postgres
> $ cd
> $ createdb sfmaps
> $ createlang plpgsql sfmaps
> $ psql -f /usr/share/lwpostgis.sql -d sfmaps (error: could not load library)
> $ psql -f /usr/share/spatial_ref_sys.sql -d sfmaps
> $ psql sfmaps
>
> if you encounter this error:
>
> libgeos_c.so.1: cannot open shared object file: No such file or
> directory<br>
>
> do this
> Add /usr/local/lib to the dynamic linker run-time bindings
>
> echo '/usr/local/lib' >> /etc/ld.so.conf.d/local-lib.conf
> ldconfig
>
>
> [edit] five - make a postgis_template (optional)
>
> This page shows how to create and use a db template:
>
> http://geospatial.nomad-labs.com/2006/12/24/postgis-template-database/
>
More information about the postgis-users
mailing list