Every once in a while you may need to install a specific version of a package on your system. If you're using the yum package manager, it isn't blatantly obvious how to do this, even after pouring over the man pages. So let's do this thing. First, if you've already installed a newer version of the package, you'll have to downgrade it. In that case, make sure you've got yum's downgrade plugin installed:
# yum install yum-allowdowngradeSecond, do you know exactly which package version you want to install? If not, list the all available versions using the --showduplicates flag. This example looks for available versions of the GD extension for PHP.
# yum --showduplicates list php-gd Available Packages php-gd.i386 5.2.3-3.el5s2 testing php-gd.i386 5.2.6-2.el5s2 testing php-gd.i386 5.2.9-2.el5.centos testing php-gd.i386 5.2.10-1.el5.centos testingYum uses the RPM package manager, and it's package names are based on the RPM package label format. In the above example, the first column displays the package name and architecture in the format NAME.ARCHITECTURE. The middle column displays the version and release info in the format VERSION-RELEASE. Don't ask me why yum rearranges the RPM package label format. Anyways, if you're downgrading, remove the previous package:
# yum remove php-gdNow that you know which version to install, it's a matter of specifying the package name with the version. Use the format NAME-VERSION.
# yum install php-gd-5.2.6Or if you want to get even more specific, use NAME-VERSION-RELEASE (which might be easier to copy/paste since VERSION-RELEASE is the second column).
# yum install php-gd-5.2.6-2.el5s2If you're downgrading, you may need to throw in the --allow-downgrade flag.
# yum --allow-downgrade install php-gd-5.2.6And you should be good to go. If you want to lock the version you installed to prevent any future updates, install the versionlock plugin.
# yum install yum-versionlockThen lock it.
# yum versionlock php-gd