In this post I want to describe the steps I had to go through when updating an Apache HTTP Server 2.2 instance running on Ubuntu 12.04 to version 2.4 without building the Apache HTTP Server from source.
The reason for upgrading Apache HTTP Server was that version 2.2 lacks support for elliptic curve ciphers.
Disclaimer: Use these instructions at your own risk! The procedure described worked for me but I cannot guarantee that it will work for you.
Since I am new to the Apache HTTP Server, I wanted to avoid building it from source assuming that it would further complicate things. Fortunately I found a PPA containing version 2.4.9 of the Apache HTTP Server for Ubuntu 12.04. The PPA can be found at https://launchpad.net/~ondrej/+archive/ubuntu/php5 [link broken]
To determine which version of the Apache HTTP Server is installed on your computer, use the following command:
Before performing the actual upgrade/install I recommend making a backup copy of the entire Apache HTTP Server configuration directory that is located at /etc/apache2, since it will be deleted in the process.
The steps described below assume that you are logged in as root on the computer on which you want to upgrade/install the Apache HTTP Server.
Let’s get started!
- Make a backup copy of the Apache HTTP Server configuration directory that is located at /etc/apache2.
- Make note of the enabled mods in the current version of your Apache HTTP Server instance:
Shell12cd /etc/apache2/mods-enabled/ls -al > ~/enabled-mods.txt
- Stop any existing instance of the Apache HTTP Server:
Shell1service apache2 stop
- Delete the directory containing the Apache HTTP Server configuration (you did make a backup, right?):
Shell1rm -r /etc/apache2/
- Remove the existing installation of the Apache HTTP Server:
Shell1234apt-get remove apache2apt-get remove apache2*apt-get purge apache2 apache2-utils apache2.2-bin apache2-commonapt-get autoremove
- Add the PPA containing version 2.4 of Apache HTTP Server for Ubuntu 12.04:
Shell123add-apt-repository ppa:ondrej/php5apt-get updateapt-get upgrade
In the case that you later want to remove the PPA for some reason, use the commands “add-apt-repository –remove ppa:ondrej/php5” and “apt-get update”.
- Install Apache HTTP Server 2.4:
Shell1apt-get install apache2
- Update any configuration files to the format used by Apache HTTP Server 2.4.
In my case, this involved the file “ports.conf” and some site configuration files (originally located in /etc/apache2/sites-available).
- Enable any custom site configurations:
If you have a site configuration file named “mysite.conf” in the “sites-available” directory, you would issue the following commands:
Shell12cd /etc/apache2/sites-enabledln -s /etc/apache2/sites-available/mysite.conf
- Enable the mods you need.
It seems like Apache HTTP Server 2.4 has a smaller number of mods enabled as per default, so I had to enable a number of mods I needed.
Shell12cd /etc/apache2/mods-enabled/ls -al
Compare the mods in this directory with the list of mods enabled in your old instance of Apache HTTP Server that was created earlier and written to the file ~/enabled-mods.txt.
For instance, if you need to enable the ssl mod, issue the following commands:
Shell12ln -s /etc/apache2/mods-available/ssl.confln -s /etc/apache2/mods-available/ssl.load
In addition to the mods I had earlier, I also had to enable the mod_socache_shmcb since it is used by the ssl mod that I needed:
Shell1ln -s /etc/apache2/mods-available/socache_shmcb.load
You may skip enabling this mod for now but if the following error message, or similar, occurs when you try to restart the Apache HTTP Server, you will have to enable it:
Shell1SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).
- Restart the Apache HTTP Server:
Shell1service apache2 restart
- Verify successful restart by looking in the Apache HTTP Server error log:
- Verify successful restart by issuing a request on port 80 to your Apache HTTP Server.
If all is well, a webpage on which there is a message saying “It works!”, among other information.
Congratulations – you have successfully upgraded/installed your Apache HTTP Server 2.4!