When installing packages via yum the default will be to install the latest and greatest package that you request. It is possible however to install previous versions of the package by first seeing what versions of the package are available followed by a more detailed command to install a previous version.
Search Package Versions
First issue the below command to use yum yo display all versions of a package. This will only work on yum versions 8.1.X and below. See below for what to do on yum versions 8.2.X and above.
- yum search package_name
Using postgresql-server as an example the “yum search” command is displayed below and shows that numerous versions of postgresql-server are available including version 8.0.17-1 to version 8.3.5-2.
- [root@linux-server ~]# yum search postgresql-server
- Loading "installonlyn" plugin
- Setting up repositories
- Reading repository metadata in from local files
- postgresql-devel.x86_64 8.0.18-1PGDG.rhel5 pgdg83
- Matched from:
- The postgresql-devel package contains the header files and libraries
- needed to compile C or C++ applications which will directly interact
- with a PostgreSQL database management server and the ecpg Embedded C
- Postgres preprocessor. You need to install this package if you want to
- develop applications which will interact with a PostgreSQL server. If
- you're installing postgresql-server, you need to install this
- package.
- postgresql-server.x86_64 8.0.17-1PGDG.rhel5 pgdg83
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- postgresql.x86_64 8.0.17-1PGDG.rhel5 pgdg83
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the docs
- in HTML for the whole package, as well as command-line utilities for
- managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql-server.x86_64 8.0.18-1PGDG.rhel5 pgdg83
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- postgresql-devel.x86_64 8.0.17-1PGDG.rhel5 pgdg83
- Matched from:
- The postgresql-devel package contains the header files and libraries
- needed to compile C or C++ applications which will directly interact
- with a PostgreSQL database management server and the ecpg Embedded C
- Postgres preprocessor. You need to install this package if you want to
- develop applications which will interact with a PostgreSQL server. If
- you're installing postgresql-server, you need to install this
- package.
- postgresql.x86_64 8.0.18-1PGDG.rhel5 pgdg83
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the docs
- in HTML for the whole package, as well as command-line utilities for
- managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql-server.x86_64 8.3.5-1PGDG.rhel5 pgdg83
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- postgresql.x86_64 8.3.5-1PGDG.rhel5 pgdg83
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the command-line
- utilities for managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a local or remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql.x86_64 8.0.19-1PGDG.rhel5 pgdg83
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the docs
- in HTML for the whole package, as well as command-line utilities for
- managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql.x86_64 8.3.5-2PGDG.rhel5 pgdg83
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the command-line
- utilities for managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a local or remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- mammoth-replicator-server.x86_64 8.3-1.8_beta1.rhel5 pgdg83
- Matched from:
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- mammoth-replicator.x86_64 8.3-1.8_beta1.rhel5 pgdg83
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the command-line
- utilities for managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a local or remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql-devel.x86_64 8.0.19-1PGDG.rhel5 pgdg83
- Matched from:
- The postgresql-devel package contains the header files and libraries
- needed to compile C or C++ applications which will directly interact
- with a PostgreSQL database management server and the ecpg Embedded C
- Postgres preprocessor. You need to install this package if you want to
- develop applications which will interact with a PostgreSQL server. If
- you're installing postgresql-server, you need to install this
- package.
- postgresql-server.x86_64 8.3.5-2PGDG.rhel5 pgdg83
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- postgresql-server.x86_64 8.0.19-1PGDG.rhel5 pgdg83
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- postgresql.x86_64 8.1.11-1.el5_1.1 base
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the docs
- in HTML for the whole package, as well as command-line utilities for
- managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql-server.x86_64 8.1.11-1.el5_1.1 base
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
- postgresql.x86_64 8.3.5-2PGDG.rhel5 installed
- Matched from:
- PostgreSQL is an advanced Object-Relational database management system
- (DBMS) that supports almost all SQL constructs (including
- transactions, subselects and user-defined types and functions). The
- postgresql package includes the client programs and libraries that
- you'll need to access a PostgreSQL DBMS server. These PostgreSQL
- client programs are programs that directly manipulate the internal
- structure of PostgreSQL databases on a PostgreSQL server. These client
- programs can be located on the same machine with the PostgreSQL
- server, or may be on a remote machine which accesses a PostgreSQL
- server over a network connection. This package contains the command-line
- utilities for managing PostgreSQL databases on a PostgreSQL server.
- If you want to manipulate a PostgreSQL database on a local or remote PostgreSQL
- server, you need this package. You also need to install this package
- if you're installing the postgresql-server package.
- postgresql-server.x86_64 8.3.5-2PGDG.rhel5 installed
- Matched from:
- postgresql-server
- The postgresql-server package includes the programs needed to create
- and run a PostgreSQL server, which will in turn allow you to create
- and maintain PostgreSQL databases. PostgreSQL is an advanced
- Object-Relational database management system (DBMS) that supports
- almost all SQL constructs (including transactions, subselects and
- user-defined types and functions). You should install
- postgresql-server if you want to create and maintain your own
- PostgreSQL databases and/or your own PostgreSQL server. You also need
- to install the postgresql package.
On yum versions 8.2.x and above you will need to use the list command to get previous versions of a package but first it will require a modification to the yum.conf file which is located in the /etc directory. Add the below line to /etc/yum.conf to enable list to show older versions of packages.
- showdupesfromrepos=1
After adding the above to yum.conf you can use the “yum list postgresql-server” command to see all available versions of postgresql-server in all of the yum repos as shown in the example below.
- [root@linux-server ~]# yum list postgresql-server
- Loading "fastestmirror" plugin
- Loading "allowdowngrade" plugin
- Loading mirror speeds from cached hostfile
- * pgdg83: yum.pgsqlrpms.org
- * rpmforge: apt.sw.be
- * base: mirror.steadfast.net
- * updates: pubmirrors.reflected.net
- * addons: mirror.steadfast.net
- * ruby: repo.premiumhelp.eu
- * extras: mirror.steadfast.net
- pgdg83 100% |=========================| 1.9 kB 00:00
- rpmforge 100% |=========================| 1.1 kB 00:00
- base 100% |=========================| 1.1 kB 00:00
- updates 100% |=========================| 951 B 00:00
- addons 100% |=========================| 951 B 00:00
- ruby 100% |=========================| 951 B 00:00
- extras 100% |=========================| 1.1 kB 00:00
- Installed Packages
- postgresql-server.i386 8.3.5-1PGDG.rhel5 installed
- Available Packages
- postgresql-server.i386 8.1.11-1.el5_1.1 base
Install Previous Version
Now our goal will be to install the 8.1.11-1 postgresql-server version even though by default yum will always choose the newest package to install. We will need to install yum-allowdowngrade to allow us to install previous package versions via yum.
- yum install yum-allowdowngrade
Now we must remove the currently installed postgresql-server as shown below.
- [root@linux-server ~]# yum remove postgresql postgresql-libs
- Loading "fastestmirror" plugin
- Loading "allowdowngrade" plugin
- Setting up Remove Process
- Loading mirror speeds from cached hostfile
- * pgdg83: yum.pgsqlrpms.org
- * rpmforge: apt.sw.be
- * base: mirror.steadfast.net
- * updates: pubmirrors.reflected.net
- * addons: mirror.steadfast.net
- * ruby: repo.premiumhelp.eu
- * extras: mirror.steadfast.net
- Resolving Dependencies
- --> Running transaction check
- ---> Package postgresql.i386 0:8.3.5-1PGDG.rhel5 set to be erased
- --> Processing Dependency: postgresql = 8.3.5-1PGDG.rhel5 for package: postgresql-server
- ---> Package postgresql-libs.i386 0:8.3.5-1PGDG.rhel5 set to be erased
- --> Running transaction check
- ---> Package postgresql-server.i386 0:8.3.5-1PGDG.rhel5 set to be erased
- --> Finished Dependency Resolution
- Dependencies Resolved
- =============================================================================
- Package Arch Version Repository Size
- =============================================================================
- Removing:
- postgresql i386 8.3.5-1PGDG.rhel5 installed 4.6 M
- postgresql-libs i386 8.3.5-1PGDG.rhel5 installed 543 k
- Removing for dependencies:
- postgresql-server i386 8.3.5-1PGDG.rhel5 installed 12 M
- Transaction Summary
- =============================================================================
- Install 0 Package(s)
- Update 0 Package(s)
- Remove 3 Package(s)
- Is this ok [y/N]: y
- Downloading Packages:
- Running rpm_check_debug
- Running Transaction Test
- Finished Transaction Test
- Transaction Test Succeeded
- Running Transaction
- Erasing : postgresql ######################### [1/3]
- Erasing : postgresql-server ######################### [2/3]
- Erasing : postgresql-libs ######################### [3/3]
- Removed: postgresql.i386 0:8.3.5-1PGDG.rhel5 postgresql-libs.i386 0:8.3.5-1PGDG.rhel5
- Dependency Removed: postgresql-server.i386 0:8.3.5-1PGDG.rhel5
- Complete!
Now remove the compat-postgresql-libs package using rpm so we can remove it without worrying about any of its dependencies.
- rpm -e --no-deps compat-postgresql-libs
Now you can install the older package versions using the following syntax.
- yum --allow-downgrade install package_name-version_number
It took me awhile to get attaching version on the end to work correctly. The –allow-downgrade will not work properly if a newer package is already installed on the server as it must me be as a switch with the yum install command and not the yum update command. A successful installation of older packages is displayed below.
- [root@server ~]# yum --allow-downgrade install postgresql-server-8.1.11-1.el5_1.1 postgresql-8.1.11-1.el5_1.1 postgresql-libs-8.1.11-1.el5_1.1
- Loading "fastestmirror" plugin
- Loading "allowdowngrade" plugin
- Loading mirror speeds from cached hostfile
- * pgdg83: yum.pgsqlrpms.org
- * rpmforge: apt.sw.be
- * base: mirror.steadfast.net
- * updates: pubmirrors.reflected.net
- * addons: mirror.steadfast.net
- * ruby: repo.premiumhelp.eu
- * extras: mirror.steadfast.net
- Setting up Install Process
- Parsing package install arguments
- Resolving Dependencies
- --> Running transaction check
- ---> Package postgresql-libs.i386 0:8.1.11-1.el5_1.1 set to be updated
- ---> Package postgresql-server.i386 0:8.1.11-1.el5_1.1 set to be updated
- ---> Package postgresql.i386 0:8.1.11-1.el5_1.1 set to be updated
- --> Finished Dependency Resolution
- Dependencies Resolved
- =============================================================================
- Package Arch Version Repository Size
- =============================================================================
- Installing:
- postgresql-server i386 8.1.11-1.el5_1.1 base 3.9 M
- Installing for dependencies:
- postgresql i386 8.1.11-1.el5_1.1 base 2.9 M
- postgresql-libs i386 8.1.11-1.el5_1.1 base 196 k
- Transaction Summary
- =============================================================================
- Install 3 Package(s)
- Update 0 Package(s)
- Remove 0 Package(s)
- Total download size: 6.9 M
- Is this ok [y/N]: y
- Downloading Packages:
- Running rpm_check_debug
- Running Transaction Test
- Finished Transaction Test
- Transaction Test Succeeded
- Running Transaction
- Installing: postgresql-libs ######################### [1/3]
- Installing: postgresql ######################### [2/3]
- Installing: postgresql-server ######################### [3/3]
- Installed: postgresql-server.i386 0:8.1.11-1.el5_1.1
- Dependency Installed: postgresql.i386 0:8.1.11-1.el5_1.1 postgresql-libs.i386 0:8.1.11-1.el5_1.1
- Complete!
Now the postgresql-server is installed as a previous package version. If having the older package is critical you will need to make sure the automated yum update process does not automatically update these packages. You can add them to the exclude list in yum.conf.
Hi,Thanks for your atclrie. I am a programmer & not a administrator. But could install mcrypt with the help of your atclrie. That was a great experience.Thanks once again.RegardsIlango Chokalingam
Hello mainuser,
No problem. Glad you found the article useful and appreciate you taking the time to leave feedback.
Thanks.
alex