How to install Mod_Pagespeed on centos

November 30, 2023 / How-to Guide

In this article, you will find how to install Mod_Pagespeed on CentOS.

mod_pagespeed is an open-source Apache module that automates web page optimisation by using filters to enhance performance. It optimises JavaScript, HTML, CSS, and images (e.g., .jpeg, .png), improving webpage load times for better user experience.

To install mod_pagespeed module, follow steps:

  1. Determine the Linux distros and the version on the server by using the following command:
    uname -a
  2. Download the latest version of mod_pagespeed from
     http://code.google.com/speed/page-speed/download.html

    Let’s consider a 64 bits CentOS Linux system for the procedure further:

    wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm
  3. Use the following command to install it:
    rpm -i mod-pagespeed-*.rpm
  4. Confirming the installed files :
    rpm -ql mod-pagespeed-beta
    
    /etc/cron.daily/mod-pagespeed
    
    /etc/httpd/conf.d/pagespeed.conf
    
    /usr/lib64/httpd/modules/mod_pagespeed.so
    
    /var/www/mod_pagespeed/cache
    
    /var/www/mod_pagespeed/files
  5. You must now restart Apache using the below command:
    service httpd restart

To upgrade the mod_pagespeed module, follow these steps:

  1. Download the latest version of mod_pagespeed from PageSpeed Downloads.
  2. Use the following command to install the downloaded package:
    yum localinstall mod-pagespeed-*.rpm
  3. Then, update the package using the commands below:
    sudo yum update
    
    sudo /etc/init.d/httpd restart

This will ensure the mod_pagespeed module is updated and running with the latest features. Reach out for help if needed.

Spread the love