Install Mod_pagespeed on EasyApache4

$> yum install rpm-build cpio ea-apache24-mod_version
$> wget https://github.com/pagespeed/cpanel/raw/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm
$> rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
$> rpm -ivh /root/rpmbuild/RPMS/x86_64/ea-apache24-mod_pagespeed*.rpm
$> /etc/init.d/httpd restart

Note: if you get following error on Step 3 :
“RPM build errors:
File must begin with “/”: %{_httpd_moddir}/*.so
File must begin with “/”: %{_httpd_modconfdir}/*.conf”

Just create a file named “macros.apache2” in ‘/etc/rpm/ directory and paste the below content into that and then restart from step 3.

%_httpd_mmn 20120211×8664
%_httpd_apxs /usr/bin/apxs
%_httpd_dir /etc/apache2
%_httpd_bindir %{_httpd_dir}/bin
%_httpd_modconfdir %{_httpd_dir}/conf.modules.d
%_httpd_confdir %{_httpd_dir}/conf.d
%_httpd_contentdir /usr/share/apache2
%_httpd_moddir /usr/lib64/apache2/modules