Monday 6 April 2015

install apache 2.2.x on ubuntu 14.04

By default, in ubuntu 14.04, if you do

sudo apt-get install apache2
apache 2.4.x would be installed. This is because ubuntu 14.04 'default' repository only contains 2.4.x. You can add ubuntu old version's repository from 'Ubuntu Software Centre'


  • Ubuntu Software Centre => 'Edit', a tab on top => 'Software Sources...' a menu item => 'Other Software' a tab item on top => click on 'Add...' button => on 'APT line' text field, put in 'deb http://archive.ubuntu.com/ubuntu precise main'. See below:

'precise' is the code name for ubuntu 12.04 LTS. 12.04 LTS comes with apache 2.2.x. After above, the 'precise' repository could be seen by

sudo apt-cache showpkg apache2

However at this point apt-get would still select apache 2.4.x over apache 2.2.x

  • Edit file /etc/apt/preferences  to assign higher priority to apache 2.2.x
below is an example

Package: apache2
Pin: release n=precise
Pin-Priority: 1000
Now, if you run below, if would use apache 2.2.x from 'precise' repository now.

sudo apt-get install apache2
Command above would probably complain something about dependencies on apache2.2-common and others. Doing below instead should work

sudo apt-get install apache2=2.2.22-1ubuntu1 apache2.2-common=2.2.22-1ubuntu1 apache2.2-bin=2.2.22-1ubuntu1 apache2-mpm-worker=2.2.22-1ubuntu1