4

How do I install an older version of Apache httpd on my CentOS 6 machine? When I do:

sudo yum --showduplicates list httpd | expand

I get:

file:///media/project/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/project/repodata/repomd.xml
Trying other mirror.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: pubmirrors.dal.corespace.com
 * extras: pubmirrors.dal.corespace.com
 * updates: repos.dfw.quadranet.com
Available Packages
httpd.x86_64                   2.2.15-45.el6.centos                      base
httpd.x86_64                   2.2.15-47.el6.centos                      updates
httpd.x86_64                   2.2.15-47.el6.centos.1                    updates

The current stable release of Apache is 2.4.18, and I need to install an older version of Apache, 2.2.26 to be exact. The version I see available to me is 2.2.15. Do I have to add another YUM repo to my machine?

When I try to do:

sudo yum install httpd-2.2.26

I get a message stating:

No package httpd-2.2.26 available

The other option I guess would be to try to build it on my machine from source.

  • 2
    I think you need to build from sources, as the one available in updates even older than the one that you need. – Serge Jan 26 '16 at 21:37
5

Simply:

yum downgrade httpd-<version-number>

The version must be available already in the repository, which you can verify with:

yum list --showduplicates httpd

You might then encounter dependency problems: an older version of httpd depends on an older package that has been obsoleted. In that case, you must remove the depending packages.

If the version you are looking for isn't available in the repo, and you can't find the RPM using rpmbone search, build from source.

  • Using the rpmpbone, I couldn't find 2.2.26 compiled for centos6/rhel6. I did find a src.rpm here: ftp.pbone.net/mirror/ftp.redhat.com/pub/redhat/linux/enterprise/… – Otheus Jan 27 '16 at 9:52
  • I built it from source which I downloaded from the Apache site. – DemiSheep Jan 27 '16 at 18:09
  • 1
    What I often do in those cases is find a spec file from a very similar version, and just modify the spec file to use the the sources for the version you need. Often you just need to change the Source line in the spec file. Then you have an installable RPM. – Otheus Jan 28 '16 at 10:14
3

Why do you want that exact version, and not the CentOS version based on 2.2.15 (presumably with backports for bugfixes up to 2.2.(last) and then some)?

CentOS is basically recompiled RHEL sources, and as an enterprisey distribution they stay with the base version from the original release of the distribution (itself carefully selected), backporting relevant bugixes, in order to be able to guarantee backward compatibility. Only if the above turns out impossible do they introduce new versions.

  • I want that specific version to match a customer's system configuration on my machine for testing. Now one interesting note is the customer is using Redhat and not CentOS which I am using. – DemiSheep Jan 27 '16 at 2:12
  • 2
    @DemiSheep, get a clone of the customer's setup. There will never be a way to make sure there are no differences due to different patches, compilation options, configuration, or just general environment (CentOS vs whatever they are running). – vonbrand Jan 27 '16 at 2:18
0

In addition to the downgrade command, it should be noted that you should shutdown the server first prior to changing the package(s):

sudo service httpd stop

On my Amazon Linux server (based on CentOS) I'm using httpd-2.4, which has dependencies on mod24_ssl and httpd24-tools.

The command I needed to use to downgrade from 2.4.39 to 2.4.38 was:

sudo yum downgrade httpd24-2.4.38 httpd24-tools-2.4.38 mod24_ssl-2.4.38

and you should expect to see this if you have the dependencies correct:

Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package httpd24.x86_64 0:2.4.38-1.86.amzn1 will be a downgrade
---> Package httpd24.x86_64 0:2.4.39-1.87.amzn1 will be erased
---> Package httpd24-tools.x86_64 0:2.4.38-1.86.amzn1 will be a downgrade
---> Package httpd24-tools.x86_64 0:2.4.39-1.87.amzn1 will be erased
---> Package mod24_ssl.x86_64 1:2.4.38-1.86.amzn1 will be a downgrade
---> Package mod24_ssl.x86_64 1:2.4.39-1.87.amzn1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================

 Package                     Arch                 Version                              Repository                  Size
========================================================================================================================

Downgrading:
 httpd24                     x86_64               2.4.38-1.86.amzn1                    amzn-updates               1.6 M
 httpd24-tools               x86_64               2.4.38-1.86.amzn1                    amzn-updates                91 k
 mod24_ssl                   x86_64               1:2.4.38-1.86.amzn1                  amzn-updates               120 k

Transaction Summary
========================================================================================================================

Downgrade  3 Packages

Total download size: 1.8 M
Is this ok [y/d/N]:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.