Installing mod_pagespeed on Ubuntu

The mod_pagespeed extension is designed to reduce the load time of pages on a web site by performing certain optimizations such as  optimizing images and minifying CSS and JavaScript. This guide covers installing mod_pagespeed on an Apache server running under Ubuntu 12.04. The process should be the same for later versions of Ubuntu as well.


Note: The mod_pagespeed package will automatically add a repository entry to your apt sources unless you tell it not to so it should stay up to date once it’s installed.

Shell into your server (SSH) and get yourself to a directory where you can download the required package. Then download the package with a wget command like this:


This is the download for the stable 64bit package, if you need the 32bit package or want to try out the beta version have a look here.

No use dpkg to install the package:

me@somewhere:/data/scrap$ sudo dpkg -i mod-pagespeed-*.deb
Selecting previously unselected package mod-pagespeed-stable.
(Reading database ... 442012 files and directories currently installed.)
Unpacking mod-pagespeed-stable (from mod-pagespeed-stable_current_amd64.deb) ...
Setting up mod-pagespeed-stable ( ...
Enabling module pagespeed.
To activate the new configuration, you need to run:
 service apache2 restart

Then use apt-get to finish the install (although on my system this did nothing):

sudo apt-get -f install

Finally, clean up the deb file:

rm mod-pagespeed-stable_current_amd64.deb


The installation will have created two files in /etc/apache2/mods-available they are pagespeed.load and pagespeed.conf. The load file will load the appropriate version of the module for the version of Apache you are running and optionally it will try to load mod_deflate if it isn’t already loaded. The conf file configures the module although to be honest the default settings will be right for almost all sites.

Once you are done having a look at the configuration files you need to restart your Apache server with:

sudo service apache2 restart

When you initially ran a speed test on your website you should have picked a page to test. Reload it a few times to ensure that everything is cached and then run another page speed test.


Posted in Linux and tagged , , .

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.