I want to use postgresql with postgis on a Centos5 64-bit machine.
I started by using the following commands as root:
> yum install postgresql
> yum install postgresql-server
> yum install postgresql-contrib
They seemed to succeed, but the service wouldn't start with 'service postgresql start'. I tried to find out if it was a version problem, like I needed to say 'service postgresql-8.4 start' or something, instead (which I had run into aa different Linux OS.) To determine which postgres was installed:
> yum list postgres*
and there were some postgres items that said 8.1 in the version column.
Then I read somewhere that I needed 8.2 or higher for postgis to work so I tried to uninstall the 8.1 version with the following commands:
> rpm -e postgresql-server
> rpm -e postgresql-contrib
> rpm -e postgresql
I didn't get any errors, so I figured it worked.
Then I installed the 8.4 version of postgis hosted at postgresql following the instructions on this page http://postgis.net/install/ but avoiding the part about changing the yum repository file (step 2) because it seemed that in my case, I did not want to exclude postgres* from being updated.
So I first did wget
> wget http://yum.postgresql.org/9.1/redhat/rhel-5-x86_64/pgdg-centos91-9.1-4.noarch.rpm
(Ignore steps 2 and 3 as well since I'd already rpm'ed postgresql-server) Next, I did
> yum install postgis21
Since postgis2 (as suggested in the instructions) was not available. I also installed the 84 server.
> yum install postgresql84-server
Now it seems like I have both 8.1 and 8.4 pieces installed.
> yum list posgres*
Installed Packages
postgresql-libs.i386 8.1.23-6.el5_8 installed
postgresql-libs.x86_64 8.1.23-6.el5_8 installed
postgresql84.x86_64 8.4.13-1.el5_8 installed
postgresql84-libs.x86_64 8.4.13-1.el5_8 installed
postgresql84-server.x86_64 8.4.13-1.el5_8 installed
postgresql92-libs.x86_64 9.2.0-og1 installed
Available Packages
postgresql.x86_64 8.1.23-6.el5_8 base
postgresql-contrib.x86_64 8.1.23-6.el5_8 base
postgresql-devel.i386 8.1.23-6.el5_8 base
postgresql-devel.x86_64 8.1.23-6.el5_8 base
postgresql-docs.x86_64 8.1.23-6.el5_8 base
postgresql-jdbc.x86_64 8.1.407-1jpp.4 base
postgresql-odbc.x86_64 08.01.0200-3.1 base
postgresql-odbc64.x86_64 09.00.0200-1.el5 base
postgresql-pl.x86_64 8.1.23-6.el5_8 base
postgresql-python.x86_64 8.1.23-6.el5_8 base
postgresql-server.x86_64 8.1.23-6.el5_8 base
postgresql-tcl.x86_64 8.1.23-6.el5_8 base
postgresql-test.x86_64 8.1.23-6.el5_8 base
postgresql84-contrib.x86_64 8.4.13-1.el5_8 base
postgresql84-devel.i386 8.4.13-1.el5_8 base
postgresql84-devel.x86_64 8.4.13-1.el5_8 base
postgresql84-docs.x86_64 8.4.13-1.el5_8 base
postgresql84-libs.i386 8.4.13-1.el5_8 base
postgresql84-plperl.x86_64 8.4.13-1.el5_8 base
postgresql84-plpython.x86_64 8.4.13-1.el5_8 base
postgresql84-pltcl.x86_64 8.4.13-1.el5_8 base
postgresql84-python.x86_64 8.4.13-1.el5_8 base
postgresql84-tcl.x86_64 8.4.13-1.el5_8 base
postgresql84-test.x86_64 8.4.13-1.el5_8 base
postgresql92.x86_64 9.2.0-og1 opengeo
postgresql92-contrib.x86_64 9.2.0-og1 opengeo
postgresql92-devel.x86_64 9.2.0-og1 opengeo
postgresql92-docs.x86_64 9.2.0-og1 opengeo
postgresql92-plperl.x86_64 9.2.0-og1 opengeo
postgresql92-plpython.x86_64 9.2.0-og1 opengeo
postgresql92-pltcl.x86_64 9.2.0-og1 opengeo
postgresql92-server.x86_64 9.2.0-og1 opengeo
And I'm stuck in the cycle shown here:
> service postgresql start
/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize
the cluster first. [FAILED]
> service postgresql initdb
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg
_log': File exists
> rm -rf /var/lib/pgsql/data/pg_log
(Okay it removes it)
> service postgresql initdb
The responses says 'Initializing database:" with nothing behind the colon.
> service postgresql start
/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize
the cluster first. [FAILED]
> service postgresql initdb
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg
_log': File exists
And so forth...
Could having these different versions on there be the problem? Any other ideas?
Thanks.
When you install RedHat provided (via centos) postgresql, it expects to have ownership over the base /var/lib/pgsql/data
folder as RHEL does not expect you to install updated major releases of postgresql. The PGDBG provided rpms allow multiple versions to exist and install data into /var/lib/psql/VERSION/data
, where version changes based on what you have installed.
If you wish to stick with RHEL supplied postgresql, you probably need to blow away the entire /var/lib/pgsql/data
directory first and then try initdb. Of course, don't do this if you have existing database data!
I'd suggest you try the 9.3 release of postgresql via PGDBG.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.