Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Because of Ubuntu updating, I made the mistake to upgrade Apache 2.2 to 2.4—many things went wrong.

I have no idea how to specify the version after apt-get remove apache2. apt-get install apache2 always installs 2.4.

How can I do it?

share|improve this question

3 Answers 3

up vote 10 down vote accepted

You need to do the following:

apt-cache showpkg <pachagename>

The above command will display list of available versions for this package. Then select the needed version and do the following.

apt-get install <packagename>=<complete version name>

Example:

apt-cache showpkg apache2
apt-get install apache2=2.2.14-5ubuntu8.7
share|improve this answer

See the ubuntu howto on package pinning:

Edit file /etc/apt/preferences

The 'preferences' file is where the actual pinning takes place. To pin a package, set its Pin-Priority to higher number. Here's an example:

Package: apache2
Pin: release n=raring
Pin-Priority: 1000

Test before running apt-get update or apt-get install with apt-cache policy apache2

See man apt_preferences for details. I chose pinning raring's release because this way you'll still get updates on the 2.2.x branch. Don't forget that you have to make the package available to APT by adding raring's repository URLs.

Update:

As raring is EOL, you could either use the still supported precise or the archived raring packages from http://old-releases.ubuntu.com.

Using this as /etc/apt/sources.list.d/raring.list will allow you to install older packages:

deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ raring-proposed main restricted universe multiverse
share|improve this answer
    
Hi. This seems to be exactly what I want. Can you please also add commands for adding raring's repository URLs? I cannot seem to find the right ones. –  Ravish Bhagdev Feb 27 at 12:44
    
I've updated my answer. –  fuero Mar 2 at 13:04
    
Nice catch, I've corrected the APT mirrorlist to raring. Of course if you want to use the precise version, /etc/apt/preferences must be changed accordingly too. –  fuero Mar 3 at 21:25
    
Thanks a lot. Anyway turning out to be a can of worms... will have to take the VM route as getting following after performing specified steps (and also trying install -f option and clean) The following packages have unmet dependencies. apache2 : Depends: apache2-mpm-worker (= 2.2.22-1ubuntu1.7) but it is not going to be installed or apache2-mpm-prefork (= 2.2.22-1ubuntu1.7) but it is not going to be installed or .... etc etc –  Ravish Bhagdev Mar 4 at 1:02

You upgraded from Ubuntu 13.04 to 13.10? There is no way to get Apache 2.2 back without going outside the Ubuntu package repositories. It's better to just fix your Apache configuration so that it works with 2.4.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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