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:
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
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 worksudo 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