Installing mod_pagespeed for Apache in CentOS

Google webmaster central blog last week announced new module mod_pagespeed for Apache web servers which make the site load very fast and still this module in beta stage.

Previously Google webmaster central came with a tool Page Speed extension for Firefox, which calculates and analyzes the web page and returns which make an element or external file makes more slowness in your web page.

What is mod_pagespeed?

mod_pagespeed is an open-source Apache module that automatically optimizes web pages and resources for better performance. mod_pagespeed includes several filter that optimize JavaScript, HTML and CSS stylesheets. It also includes filters for optimizing JPEG and PNG images.

mod_pagespeed module comes for different Linux distributions like Debian/Ubuntu and CentOS/Fedora and also for 32 bit and 64-bit distributions.

Command to check either 32 or 64-bit distribution

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-194.17.4.el5 #1 SMP Mon Oct 25 15:51:07 EDT 2010 i686 i686 i386 GNU/Linux

Here my distribution is the 32-bit operating system. So I’ve downloaded mod-pagespeed-beta_current_i386.rpm from Google code

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.rpm

For 64-bit distribution

 wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb 

After downloading, while trying to install using YUM and RPM commands, I got warning messages

rpm -i mod-pagespeed-beta_current_i386.rpm
yum localinstall mod-pagespeed-beta_current_i386.rpm
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 7fac5991

Public key for mod-pagespeed-beta_current_i386.rpm is not installed

Resolution


For this first you need to install and import Google key into RPM, later you need to try installing mod_pagespeed package.

wget https://dl-ssl.google.com/linux/linux_signing_key.pub
rpm --import linux_signing_key.pub

After installing Google key, you can use yum localinstall command to install the mod_pagespeed

[root@localhost ~]# yum localinstall mod-pagespeed-beta_current_i386.rpm
Loaded plugins: fastestmirror, priorities
Setting up Local Package Process
Examining mod-pagespeed-beta_current_i386.rpm: mod-pagespeed-beta-0.9.1.1-171.i386
Marking mod-pagespeed-beta_current_i386.rpm to be installed
Loading mirror speeds from cached hostfile
 * addons: mirrors.gitam.edu
 * base: mirrors.gitam.edu
 * epel: bali.idrepo.or.id
 * extras: mirrors.gitam.edu
 * ius: mirror.its.dal.ca
 * updates: mirrors.gitam.edu
Resolving Dependencies
--> Running transaction check
---> Package mod-pagespeed-beta.i386 0:0.9.1.1-171 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch  Version      Repository                         Size
================================================================================
Installing:
 mod-pagespeed-beta  i386  0.9.1.1-171  /mod-pagespeed-beta_current_i386  1.5 M

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mod-pagespeed-beta                                       1/1
job 1 at 2010-11-09 09:11

Installed:
  mod-pagespeed-beta.i386 0:0.9.1.1-171                                         

Complete!

After installation, I recommend restarting your HTTPD service

[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]