Quick Install mod_pagespeed on Centos

How to install mod_pagespeed in Centos
How to install mod_pagespeed in Centos

Download mod_pagespeed in Centos.

First thing first, make sure your server is updated & upgraded before you begin , for this enter the following command in terminal. (You can always check this page for releases)

 sudo yum update && yum upgrade -y

This will automatically update all your Centos system packages and upgrade system if required. (This might take some time).

Once the upgrade is finished , enter the following commands.

cd /home/
yum install at
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm

If you don’t have “wget” installed, install it by entering following command

yum install wget -y

Install mod_pagespeed in Centos

Once you have finished downloading the “mod_pagespeed” RPM package, you can execute the following commands to install it:

rpm -U mod-pagespeed-*.rpm

Once the above step is successfully finished, all you need to do is to simply restart nginx/apache on your centos configuration. Enter following command in shell

systemctl restart nginx && systemctl restart httpd && systemctl restart php-fpm

This will restart all the services including “nginx”, “apache” and php’s “php-fpm” if installed.

Check mod_pagespeed installed on Centos?

To check if your installation was successfull, all you need to do is to simply run a curl request or check my article about checking if mod_pagspeed is working on your website?

To check it inside the shell, enter the following command:

curl -D- localhost | less

If you see “X-Mod-Pagespeed” in shell after executing above command, then it was successfull!

Let me know if you have any problems installing this.