Skip to content

What is new in PostgreSQL 9.0 RPMs?

I know it's been more than a week since I published 9.0 RPMs, and I'm a bit late to write this article -- sorry, I just could find time.
Years ago, I have started a project to support parallel PostgreSQL version installation feature with RPMs, like Ubuntu/Debian folks have been doing for many years, but I could not complete it because of this and that. However, this time I bite the bullet, and given that we already bumped the major version to 9.0, this was a good chance to enable this feature and break existing scripts! :-)

The main goal is not just to be able to install different PostgreSQL versions on the same machine -- we also needed to support different 3rd party software to be compiled and installed using the new scheme. Honestly, that is the hardest part. We have 60+ different packages, and even in noarch packages, I had to replace dependency from postgresql to postgresql90...

What? Where did 90 suffix come from?

In the early phase of 9.0(or say, 8.5) development, there were some problems with testing:

** I did not use yum to test, I only used rpm command.
** I did not have 9.1, so that I could really test parallel installation.

I was lucky enough, and 9.1 Alpha1 was released just 1 week before 9.0.0 was released. After working on 9.1 RPMs and pushing them to yum repository, I could perform a real test which failed immediately. The oversight was that the package names were the same, and yum thought that 9.1 was an upgrade to 9.0....

... so I had to find another way. Tom pushed 8.4 packages as of RHEL 5.5, and to avoid confusion, he added 84 suffix to package names (postgresql84, postgresql84-server, etc). I borrowed that idea, and changed package names... Sorry guys, I had to do it.

One of the biggest change in spec file is:

%define pgbaseinstdir /usr/pgsql-%{majorversion}

and I used this in most part of the spec file.

Another change is using alternatives method. See here for details.

Now, let's give an example about how to install PostgreSQL 9.0 my Fedora 13 box. It is more or less the same with the other Fedora/RHEL/CentOS releases. Please refer to yum howto link for more details, especially for the YUM repository configuration RPMs.

First, let's install repo RPM:

# rpm -ivh
warning: /var/tmp/rpm-tmp.aczMlm: Header V3 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing... ########################################### [100%]
1:pgdg-fedora ########################################### [100%]

Nice. Now, we can install PostgreSQL 9.0:

# yum install postgresql90-server postgresql90-contrib
< output trimmed >
postgresql90-contrib.i686 0:9.0.0-1PGDG.f13.1 postgresql90-server.i686 0:9.0.0-1PGDG.f13.1

Dependency Installed:
postgresql90.i686 0:9.0.0-1PGDG.f13.1 postgresql90-libs.i686 0:9.0.0-1PGDG.f13.1 uuid.i686 0:1.6.1-11.fc13


As of 9.0, init script name also changed. It now contains major PostgreSQL version number: /etc/init.d/postgresql-9.0 .

# service postgresql-9.0 initdb
Initializing database: [ OK ]
# service postgresql-9.0 start
Starting postgresql-9.0 service: [ OK ]

Great. Service started. That was easy, right? Well, there are some more issues actually. The major change in file layout is that PostgreSQL stuff, except data directory, is now installed under /usr/pgsql-9.0, not /usr:

# ls /usr/pgsql-9.0/
bin include lib share

and the data directory changed, too. In previous versions, we used /var/lib/pgsql as the base directory, and /var/lib/pgsql/data as data directory. Base directory remained the same. However, data directory had to change for parallel installation. It is now /var/lib/pgsql/9.0/data . initdb procedure in init script performs cluster initialization in this directory automagically.

One of the most FAQ is: Where are my binaries gone? Why didn't you add /usr/pgsql-9.0/bin to $PATH

For various reasons, we did not add it to $PATH, which would be a silly thing given that we want to support multiple versions. Instead, we used alternatives method to install most common binaries. These are:


Please note that all of these are backwards compatible binaries. They will be replaced with 9.1 ones when installed, but they won't break your applications.

So, what about ecpg, initdb, oid2name, pg_config, pg_resetxlog, postgres and others? They are under /usr/pgsql-9.0/bin directory. That may break your existing scripts -- but that is what I had to do for a .0 release. :-) Please don't symlink them under /usr/bin, and instead fix your scripts.

I want to thank Greg Smith for his great support and great ideas in both early stages and the last stages. For example, using alternatives method is his idea.


No Trackbacks


Display comments as Linear | Threaded

Magnus Hagander on :

Do you have something to cover those commands if they are not backwards compatible?

For example, pg_dump/pg_restore isn't that backwards compatible is it? If I run both say 8.1 and 9.0, I can use the 9.0 pg_dump to dump 8.1 only if I want to restore it on 9.0 - if I want to restore it on 8.1, that will break. And I don't think we guarantee something similar won't happen with 9.0->9.x.

Devrim GÜNDÜZ on :

Right, by "backward-compatible", I meant that you can use those utilities with back branches. I am referring to the alternatives method there -- you can dump 9.0 using 9.1, and restore it to 9.1. Still, you are right, the wording is a bit ambigiuos.

arıkan on :

Centos için bildiğiniz bir depo varmı Devrim Bey ?

Devrim GÜNDÜZ on : ?

Darren Duncan on :

Whenever I name version-specific things, I always use a separator, usually an underscore, between each number composing the version, so that it is unambiguous when numbers gain a digit. So I would use postgres_9_0 rather than postgres90, for example.

Devrim GÜNDÜZ on :

We also renamed 3rd party packages, so using _9_0 would be hard for people, since they would have to type extra _'s ;-)

Still, I wanted to follow what Red Hat(Tom) did at RHEL 5.5 PostgreSQL 8.4 packages...

Ryan Wallace on :

I ran a yum update to upgrade from Postgresql 9.0 to 9.0.1 and the common binaries that were installed (pg_dump, psql) are no longer. Is this supposed to happen or did I screw something up?

Devrim GÜNDÜZ on :

Could be an issue on your side. Please test latest 9.0.1 (9.0.1-4) RPMs. They are much more stable.

Brian Dunford-Shore on :

Just to let you know:
On FC13 with postgresql-server-8.4.5 (FC13 version) installed, when trying to install postgresql90-server, I get:

Transaction Check Error:
file /var/lib/pgsql/.bash_profile from install of postgresql90-server-9.0.1-1PGDG.f13.x86_64 conflicts with file from package postgresql-server-8.4.5-1.fc13.x86_64

I have worked around it by copying off the conflicting file, downloading the rpms, adding --force to the rpm installation command line, and then copying the conflicting file back.

Devrim GÜNDÜZ on :

I already fixed it -- but thanks for the report.

Joseph Genova on :

Hello -
I'm having the same problem. I renamed /var/lib/pgsql/.bash_profile, but still get the conflict error. why ? and if I renamed .bash_profile, why would I still need to add --force flag to the install ?


Devrim GÜNDÜZ on :

@Joseph: Which OS/arch? What is the actual release number?

spider on :

I would like to install postgres 9.0 on CentOS 5.5, just like I installed postgres 8.4 pgdg RPM's, and then rebuild vendor SRPM's (like php, httpd, etc.) using the new pg 9.0 libraries.

This new RPM craziness seems to have completely broken vendor integration. Is there a way to build the postgres SRPMS so it will install at /usr just like the old days? I have tried hacking the SPEC file, and one fix leads to another break.

Devrim GÜNDÜZ on :

What is one of the error messages?

All you may need is to symlink pg_config under /usr/bin. I don't expect nothing more, but I'd like to see the error first.

spider on :

I changed this:

%define pgbaseinstdir /usr

so I had to change these with include/pgsql/server :

mv %{buildroot}%{pgbaseinstdir}/include/pgsql/server/pg_config.h %{buildroot}%{pgbaseinstdir}/include/pgsql/server/pg_config_`uname -i`.h
install -m 644 %{SOURCE5} %{buildroot}%{pgbaseinstdir}/include/pgsql/server/

Which leads to shload of File not found errors (and i notice it is not using /usr/lib64/ for standard x86_64 support). Here is a small sampling of errors:

RPM build errors:
File not found: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/lib/
File not found: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/share/postgres.bki
File not found by glob: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/share/*.sample
File not found by glob: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/share/timezonesets/*
File not found by glob: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/share/tsearch_data/*.affix
File not found: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/lib/
File not found: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/lib/
File not found by glob: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/lib/*_and_*.so
File not found: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/share/conversion_create.sql
File not found: /var/tmp/postgresql90-9.0.2-1PGDG-root-build/usr/share/information_schema.sql

Devrim GÜNDÜZ on :

Ok, so please install those files under /usr in spec file manually.

Keith Gabryelski on :

yum install postgresql90-server postgresql90-contrib

gives me this error (i am rpm/yum challenged, do you have explicit instructions on how to get around this issue -- centos installation -- I have postgres 8.4.6 installed and running):

# yum install postgresql90-server postgresql90-contrib
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* updates:
rightscale-epel | 951 B 00:00
Excluding Packages from none
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql90-contrib.x86_64 0:9.0.2-2PGDG.rhel5 set to be updated
--> Processing Dependency: postgresql90 = 9.0.2 for package: postgresql90-contrib
---> Package postgresql90-server.x86_64 0:9.0.2-2PGDG.rhel5 set to be updated
--> Running transaction check
---> Package postgresql90.x86_64 0:9.0.2-2PGDG.rhel5 set to be updated
--> Processing Dependency: postgresql90-libs = 9.0.2-2PGDG.rhel5 for package: postgresql90
--> Running transaction check
---> Package postgresql90-libs.x86_64 0:9.0.2-2PGDG.rhel5 set to be updated
--> Processing Conflict: postgresql-server conflicts postgresql < 7.4
--> Finished Dependency Resolution
postgresql-server-8.4.6-1PGDG.rhel5.x86_64 from installed has depsolving problems
--> postgresql-server conflicts with postgresql90
Error: postgresql-server conflicts with postgresql90
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest

Devrim GÜNDÜZ on :

Unfortunately, this feature is available in 9.0+ installations. The only exception is RHEL 6 -- it has this feature in 8.4+ RPMs.

Walter W. on :

I have the same "depsolving" error in Centos.
Anything can be checked?

Excluding Packages from CentOS-5 - Base
Excluding Packages from CentOS-5 - Updates
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql90.i386 0:9.0.4-1PGDG.rhel5 set to be updated
--> Processing Dependency: postgresql90-libs = 9.0.4-1PGDG.rhel5 for package: postgresql90
--> Running transaction check
---> Package postgresql90-libs.i386 0:9.0.4-1PGDG.rhel5 set to be updated
--> Processing Conflict: postgresql-server conflicts postgresql < 7.4
--> Finished Dependency Resolution
postgresql-server-8.4.4-2PGDG.el5.i386 from installed has depsolving problems
--> postgresql-server conflicts with postgresql90
Error: postgresql-server conflicts with postgresql90

Devrim GÜNDÜZ on :

You need to remove old packages first (and take backup)

Clemens Schwaighofer on :

I am sorry, but your comment doesn't make sense.

So I cannot install postgresql 9.0 in EL5 while 8.4 is installed?
I could do that on a EL4 with an even older postgresql 8.3 installed.

And I also do not understand the error ...

Devrim GÜNDÜZ on :

Let me rephrase:

This feature is available only for PostgreSQL 9.0+ for ALL distros. The only exception is RHEL 6, and you can install 8.4+ to RHEL6 in parallel.

*Using RPMs*, you cannot install this on EL-4 and PostgreSQL 8.3 -- but you can do it using source installation.

Is that ok now.?


Clemens Schwaighofer on :

This is still strange:

I have a Redhat EL4 box with hand installed postgresql 8.3 RPMS:
and I could install the 9.0 postgresql from the yum repository:

On a RedHat EL5 box I have postgresql 8.4 RPMS installed by hand:
but when I try to install the postgresql 9.0 via yum (with the same yum install file provided on the postgresql yum rpm list page) I get the same error as the parent poster.
I does not allow me to install postgresql 9.0 because it has some "conflict" with a postgresql < 7.4 ...

Devrim GÜNDÜZ on :

Are both deamons running w/o any issues?

Clemens Schwaighofer on :

Yes, on the EL4 box both deamons run w/o any issues. Only problem was that the port was hard set in the init file.

Devrim GÜNDÜZ on :

That is strange. I need to look at it.

Josephine on :

first time seeing postgres and I have to install it

is pgdg-centos91-9.1-4.noarch.rpm the only rpm I need to install to get this going or do I need other rpms?

Some blogs have different rpms listed for older versions. I can't seem to find doc for someone just starting out.

Secondly, I need to also install PHP and apache and make it work with postfresql.

Will appreciate any info


Devrim GÜNDÜZ on :

pgdg-centos91-9.1-4.noarch.rpm is what you need. Other blogs probably refer to the old versions.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Form options