apache / incubator-pagespeed-cpanel

mod_pagespeed module for CPanel WHM
Other
144 stars 50 forks source link

cannot be installed #50

Open marlowmedia opened 8 years ago

marlowmedia commented 8 years ago

Hey,

I'm trying to install it on my server, i've followed the first 2 steps but then what i get to this:

rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm

I get this error:

[root@server /]# rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm Installing ea-apache24-mod_pagespeed-latest-stable.src.rpm error: ea-apache24-mod_pagespeed-latest-stable.src.rpm cannot be installed

Why cant i install it on my cpanel/whm server? I've updated/upgraded to EasyApache4 so it should work. It doesnt give me any information as to why it cannot be installed but id love to find a solution to my issue.

CENTOS 7.2 x86_64 kvm – server WHM 56.0 (build 25)

Please help, thank you!

KingServer commented 7 years ago

same problem

ntorga commented 7 years ago

Try:

rm -rf /root/rpmbuild/RPMS/x86_64/ yum install -y rpm-build cpio ea-apache24-mod_version wget https://github.com/Prajithp/cpanel/blob/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm rpm -Uvh /root/rpmbuild/RPMS/x86_64/ea-apache24-mod_pagespeed*.rpm /etc/init.d/httpd restart

If you get:

error: File must begin with "/": %{_httpdmoddir}/.so error: File must begin with "/": %{_httpdmodconfdir}/.conf

Create the file /etc/rpm/macros.apache2 and put:

%_httpd_mmn 20120211x8664 %_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

Then, restart the process.

Source: https://github.com/pagespeed/cpanel/issues/44#issuecomment-207992947

KingServer commented 7 years ago

Hello ntorga Not work

Installing ea-apache24-mod_pagespeed-latest-stable.src.rpm error: ea-apache24-mod_pagespeed-latest-stable.src.rpm cannot be installed

yeya commented 7 years ago

@ntorga is right, just change the wget to wget https://github.com/pagespeed/cpanel/raw/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm

Thank you very much

ntorga commented 7 years ago

Glad I help you @yeya.

@KingServer did you rm the .rpm first? I mean, when you wget it, you will be saving like: ea-apache24-mod_pagespeed-latest-stable.src.rpm.1 or ea-apache24-mod_pagespeed-latest-stable.src.rpm.2

You have to rm the .rpm and then download it again. Like @yeya says, the right one is from PS cPanel repo.

Later I will write a shell script to install PS in a simpler way.

KingServer commented 7 years ago

@ntorga yes i deleted old .rpm file first, but unfortunately not working I'm using Centos 7.2 64bit

ntorga commented 7 years ago

Did you tried with both files?

wget https://github.com/pagespeed/cpanel/raw/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm

or

wget https://github.com/Prajithp/cpanel/blob/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm

nbwpuk commented 7 years ago

Not sure if it helps but, I have just successfully installed on CloudLinux 6.8; I did have to change to this:

# 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 (which errored) Added config in vi /etc/rpm/macros.apache2 # rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm # rpm -ivh /root/rpmbuild/RPMS/x86_64/ea-apache24-mod_pagespeed-latest-stable.x86_64.rpm # /etc/init.d/httpd restart

KingServer commented 7 years ago

Hello, @BatchHeader @ntorga i see the following error during rebuild

root@server [~]# rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm Installing ea-apache24-mod_pagespeed-latest-stable.src.rpm Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.YClSWF

RPM build errors: Bad exit status from /var/tmp/rpm-tmp.ZCTwES (%build)

Where is the problem ? and how do I fix

ntorga commented 7 years ago

I don't have a CentOS 7.2 to reproduce the error, but looks like a problem in the source package. As the log shows, the building path is /root/rpmbuild/BUILD, so:

rm -rf /root/rpmbuild/BUILD

Then, restart the process of installation normally.

KingServer commented 7 years ago

@ntorga i have deleted /root/rpmbuild/BUILD but not working i received some result

root@server [~]# rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm Installing ea-apache24-mod_pagespeed-latest-stable.src.rpm Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.YClSWF

umask 022 cd /root/rpmbuild/BUILD wget -q -N -O mod-pagespeed-stable.rpm https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.ZCTwES umask 022 cd /root/rpmbuild/BUILD rpm2cpio mod-pagespeed-stable.rpm cpio -idmv argument is not an RPM package cpio: premature end of archive error: Bad exit status from /var/tmp/rpm-tmp.ZCTwES (%build)

ntorga commented 7 years ago

If you try:

cd /root/rpmbuild/BUILD wget -q -N -O mod-pagespeed-stable.rpm https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm rpm2cpio mod-pagespeed-stable.rpm | cpio -idmv

Do you get the same result, right?

KingServer commented 7 years ago

@ntorga i see the follwing message

root@server [~/rpmbuild/BUILD]# rpm2cpio mod-pagespeed-stable.rpm | cpio -idmv argument is not an RPM package cpio: premature end of archive

ntorga commented 7 years ago

Looks like your rpm2cpio isn't working right or the package was wrongly downloaded. Ok... is your server a production server or a test server? We could try catch the .so file from .deb, but I can't guarantee it's safe to do. If you wanna try (your risk):

mkdir -p /root/rpmbuild/BUILD cd /root/rpmbuild/BUILD wget -q -N -O mod-pagespeed-stable.deb https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb ar -p mod-pagespeed-stable.deb data.tar.gz | tar zx mv usr/lib64/httpd/modules/mod_pagespeed{,_ap24}.so . install -m755 mod_pagespeed_ap.so /etc/apache2/modules/ install -m755 mod_pagespeed_ap24.so /etc/apache2/modules/ wget https://raw.githubusercontent.com/pagespeed/cpanel/master/EA4/SOURCES/456_pagespeed.conf -O /etc/apache2/conf.modules.d/456_pagespeed.conf chmod 644 /etc/apache2/conf.modules.d/456_pagespeed.conf cd / && rm -rf /root/rpmbuild/BUILD /etc/init.d/httpd restart

At least that's the logic of .spec file. If it works, I will put it on a shell script.

KingServer commented 7 years ago

@ntorga

ar p mod-pagespeed-stable.deb data.tar.gz | tar zx

ar: /root/rpmbuild/BUILD/mod-pagespeed-stable.deb: File format not recognized

gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now

ntorga commented 7 years ago

Try: ar x mod-pagespeed-stable.deb && tar -zvxf data.tar.gz

If doesn't work, post the output of: ar --version

KingServer commented 7 years ago

@ntorga

Unfortunately not working

root@server [~/rpmbuild/BUILD]# ar x mod-pagespeed-stable.deb && tar -zvxf data.tar.gz ar: mod-pagespeed-stable.deb: File format not recognized root@server [~/rpmbuild/BUILD]# ar --version GNU ar version 2.23.52.0.1-55.el7 20130226 Copyright 2013 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty.

ntorga commented 7 years ago

Ok. Since "ar" and "rpm2cio" doesn't work for you, let's use dpkg in the same process:

yum -y install epel-release yum -y install dpkg mkdir -p /root/rpmbuild/BUILD cd /root/rpmbuild/BUILD wget -q -N -O mod-pagespeed-stable.deb https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb dpkg -x mod-pagespeed-stable.deb . mv usr/lib64/httpd/modules/mod_pagespeed{,_ap24}.so . install -m755 mod_pagespeed_ap.so /etc/apache2/modules/ install -m755 mod_pagespeed_ap24.so /etc/apache2/modules/ wget https://raw.githubusercontent.com/pagespeed/cpanel/master/EA4/SOURCES/456_pagespeed.conf -O /etc/apache2/conf.modules.d/456_pagespeed.conf chmod 644 /etc/apache2/conf.modules.d/456_pagespeed.conf cd / && rm -rf /root/rpmbuild/BUILD /etc/init.d/httpd restart

Let me know if you find any error. If you get success, you can remove dpkg:

yum -y remove dpkg

KingServer commented 7 years ago

@ntorga Thank you so much for your help.

root@server [~/rpmbuild/BUILD]# dpkg -x mod-pagespeed-stable.deb dpkg-deb: error: --extract needs a target directory. Perhaps you should be using dpkg --install ?

ntorga commented 7 years ago

That's not a problem. You are helping me improve my knowledge.

Nops. You canot run dpkg --install in RHEL/CentOS. We are using dpkg just to extract the .deb and get the .so files.

You forgot the dot in the end of the line:

dpkg -x mod-pagespeed-stable.deb .

. = destination, the dot means the working path, is the same as /root/rpmbuild/BUILD since you are there.

KingServer commented 7 years ago

@ntorga now i see the following error

root@server [~/rpmbuild/BUILD]# dpkg -x mod-pagespeed-stable.deb . dpkg-deb: error: `mod-pagespeed-stable.deb' is not a debian format archive

ntorga commented 7 years ago

Like I expected. Do you have a firewall on your server right?

Post the output of the following command, please:

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

You probably will get that the connection couldn't be done. So, if you get, try to open the ports 80 and 443 of outgoing tcp. If you use CSF, for example, just go to the firewall configurations and put 80,443 in TCP_OUT field and restart the firewall. Do that in the IPv6 part too if your server supports it.

KingServer commented 7 years ago

@ntorga

80 and 443 already added in TCP_OUT in csf firewall

output :

root@server [~/rpmbuild/BUILD]# wget -O mod-pagespeed-stable.deb https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb --2016-09-01 19:08:50-- https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb Resolving dl-ssl.google.com (dl-ssl.google.com)... 64.233.184.136, 64.233.184.93, 64.233.184.91, ... Connecting to dl-ssl.google.com (dl-ssl.google.com)|64.233.184.136|:443... connected. HTTP request sent, awaiting response... 302 Found Location: http://dl.google.com/service/prod_unavailable.html [following] --2016-09-01 19:08:50-- http://dl.google.com/service/prod_unavailable.html Resolving dl.google.com (dl.google.com)... 64.233.184.91, 64.233.184.136, 64.233.184.93, ... Connecting to dl.google.com (dl.google.com)|64.233.184.91|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1487 (1.5K) [text/html] Saving to: ‘mod-pagespeed-stable.deb’

100%[=================================================================================================>] 1,487 --.-K/s in 0s

2016-09-01 19:08:50 (190 MB/s) - ‘mod-pagespeed-stable.deb’ saved [1487/1487]

ntorga commented 7 years ago

That's the problem!

Connecting to dl-ssl.google.com (dl-ssl.google.com)|64.233.184.136|:443... connected. HTTP request sent, awaiting response... 302 Found Location: http://dl.google.com/service/prod_unavailable.html [following]

Which is basically: "This product is not available in your country". So, you are downloading a HTML page as the package file. Since the wget command of the installer available on this official repo uses "-q" variable, you weren't seeing the problem.

You could try a mirror of the .deb or .rpm file; or use a proxy to download the file. I would download in my computer, then upload it via SFTP to the /root/rpmbuild/BUILD and run:

If you choose the .rpm file:

rpm2cpio mod-pagespeed-stable.rpm | cpio -idmv

If you choose the .deb file:

dpkg -x mod-pagespeed-stable.deb .

Then:

mv usr/lib64/httpd/modules/mod_pagespeed{,_ap24}.so . install -m755 mod_pagespeed_ap.so /etc/apache2/modules/ install -m755 mod_pagespeed_ap24.so /etc/apache2/modules/ wget https://raw.githubusercontent.com/pagespeed/cpanel/master/EA4/SOURCES/456_pagespeed.conf -O /etc/apache2/conf.modules.d/456_pagespeed.conf chmod 644 /etc/apache2/conf.modules.d/456_pagespeed.conf cd / && rm -rf /root/rpmbuild/BUILD /etc/init.d/httpd restart

KingServer commented 7 years ago

@ntorga Thank you so much for your great help, it's highly appreciated, i've now got it working with apache, should i make any changes to get it working with nginx as well? i have checked again and worked fine with apache and nginx

ntorga commented 7 years ago

@KingServer Glad I could help you. :smile: