Yum install mod_passenger not working on CentOS 7

1,134 views
Skip to first unread message

Aston J

unread,
Jul 27, 2015, 10:19:28 AM7/27/15
to phusion-...@googlegroups.com
I have run into problems with this on two CentOS 7 servers now and am wondering whether you are aware of these issues.

On the older server I just reverted to the `gem install passenger` method.

On this newer server (both are formatted with a minimal CentOS 7 install) I tried `yum install mod_passenger` and it reported that it had installed fine. I set up my site as usual, and added the `PassengerRuby...` line but Apache failed to start referring to the PassengerRuby line as the problem.

So I `yum remove mod_passenger` and try install via `gem install passenger` with `passenger-install-apache2-module`, but this doesn't work now (guess there is some sort of conflict by having already installed it). It also warned that apache was not built some things it required (WARNING: Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM) - though when it did the initial check everything was fine.

I also looked at your new install guides (https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/el7/install_passenger.html) but there are several mistakes, such as `service httpd restart`
which should be `systemctl restart httpd` also, there are many references to files that would be on Debian install rather than CentOS (such as `/etc/apache2/sites-enabled/myapp.conf` and `sudo apachectl restart`)


Does anyone know how I can completely remove all traces of Passenger (via both the gem and yum install methods) so that I can start again please? Should I also just forget the yum install method and do the usual gem install method?


EDIT: I have checked `/etc/httpd/conf.modules.d/00-mpm.conf` and I do seem to have mpm_prefork:

# Select the MPM module which should be used by uncommenting exactly

# one of the following LoadModule lines:


# prefork MPM: Implements a non-threaded, pre-forking web server

# See: http://httpd.apache.org/docs/2.4/mod/prefork.html

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so


# worker MPM: Multi-Processing Module implementing a hybrid

# multi-threaded multi-process web server

# See: http://httpd.apache.org/docs/2.4/mod/worker.html

#

#LoadModule mpm_worker_module modules/mod_mpm_worker.so


# event MPM: A variant of the worker MPM with the goal of consuming

# threads only for connections with active processing

# See: http://httpd.apache.org/docs/2.4/mod/event.html

#

#LoadModule mpm_event_module modules/mod_mpm_event.so


Hongli Lai

unread,
Jul 27, 2015, 11:07:18 AM7/27/15
to phusion-passenger
On Mon, Jul 27, 2015 at 4:19 PM, Aston J <asto...@gmail.com> wrote:
> I have run into problems with this on two CentOS 7 servers now and am
> wondering whether you are aware of these issues.
>
> On the older server I just reverted to the `gem install passenger` method.
>
> On this newer server (both are formatted with a minimal CentOS 7 install) I
> tried `yum install mod_passenger` and it reported that it had installed
> fine. I set up my site as usual, and added the `PassengerRuby...` line but
> Apache failed to start referring to the PassengerRuby line as the problem.

Did you install the Phusion APT repository prior to 'yum install
mod_passenger'? Otherwise you will get the Passenger package as
supplied by CentOS. We can't make any guarantees about that package.

> I also looked at your new install guides
> (https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/el7/install_passenger.html)
> but there are several mistakes, such as `service httpd restart`
> which should be `systemctl restart httpd` also, there are many references to
> files that would be on Debian install rather than CentOS (such as
> `/etc/apache2/sites-enabled/myapp.conf` and `sudo apachectl restart`)

It looks like we overlooked this, thanks for reporting this. I'm
pushing out an update. Although I'd like to note that 'sudo apachectl
restart' works fine on CentOS 7.


> Does anyone know how I can completely remove all traces of Passenger (via
> both the gem and yum install methods) so that I can start again please?

The uninstallation methods are documented here:
https://www.phusionpassenger.com/library/install/apache/uninstall/oss/


> Should I also just forget the yum install method and do the usual gem
> install method?

No. The recommended installation method for CentOS 7 is through the
RPMs in the Phusion YUM repository.

--
Phusion B.V. | Web Application deployment, scaling, and monitoring solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 63501007 (The Netherlands)

Aston J

unread,
Jul 27, 2015, 12:32:36 PM7/27/15
to Phusion Passenger Discussions, hon...@phusion.nl
Hi Hongli,

I installed with the following commands:

yum install epel-release pygpgme curl
curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
chown root: /etc/yum.repos.d/passenger.repo
chmod 600 /etc/yum.repos.d/passenger.repo
yum install mod_passenger
systemctl restart httpd

I used this on both servers - is something missing here?

Hongli Lai

unread,
Jul 27, 2015, 2:43:40 PM7/27/15
to Aston J, Phusion Passenger Discussions
On Mon, Jul 27, 2015 at 6:32 PM, Aston J <asto...@gmail.com> wrote:
> Hi Hongli,
>
> I installed with the following commands:
>
> yum install epel-release pygpgme curl
> curl --fail -sSLo /etc/yum.repos.d/passenger.repo
> https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
> chown root: /etc/yum.repos.d/passenger.repo
> chmod 600 /etc/yum.repos.d/passenger.repo
> yum install mod_passenger
> systemctl restart httpd
>
> I used this on both servers - is something missing here?

These commands are correct. They should work. What issues are you
experiencing right now? Can you post any error messages?

Aston J

unread,
Jul 27, 2015, 3:01:25 PM7/27/15
to Phusion Passenger Discussions, hon...@phusion.nl
I have reinstalled the OS, but when I tried it before the problem I had was Apache would not restart after I added the PassengerRuby line for a virtual host entry (the error referred to that line as 'unrecognised'). I also noticed there was nothing else in the httpd.conf file referring to Passenger - is that normal? (When we install via the Gem we need to add 3 or 4 lines to it.)

Does it matter that I was using a more recent Ruby version with Chruby?

Are there any downsides to using the gem install passenger method?

Hongli Lai

unread,
Jul 27, 2015, 4:01:53 PM7/27/15
to Aston J, Phusion Passenger Discussions
On Mon, Jul 27, 2015 at 9:01 PM, Aston J <asto...@gmail.com> wrote:
> I have reinstalled the OS,

Does this mean you are no longer experiencing the problem?

> but when I tried it before the problem I had was
> Apache would not restart after I added the PassengerRuby line for a virtual
> host entry (the error referred to that line as 'unrecognised').

This indicates that the Passenger module is not loaded into Apache;
see my comments below.

> I also
> noticed there was nothing else in the httpd.conf file referring to Passenger
> - is that normal? (When we install via the Gem we need to add 3 or 4 lines
> to it.)

If you install Passenger through the Phusion YUM repository, then the
RPM is supposed to install an Apache config file for you which loads
Passenger. This config file is located in
/etc/httpd/conf.d/passenger.conf. Maybe the RPM failed to install this
file for some reason, which would cause Apache not to load Passenger.
In normal circumstances you shouldn't have to bother inserting
'PassengerRoot' into httpd.conf.


> Does it matter that I was using a more recent Ruby version with Chruby?

No: https://www.phusionpassenger.com/library/indepth/ruby/multiple_rubies.html


> Are there any downsides to using the gem install passenger method?

The downsides are:
1. Compilation is required, which takes time and memory. When using
the Phusion YUM repository, nothing has to be compiled.
2. You need to install any required dependencies. The RPMs from the
YUM repository take care of installing dependencies for you.
3. You need to figure out how to make everything work with SELinux.
The RPMs from the YUM repository install an SELinux policy for
Passenger so that everything works.

Aston J

unread,
Jul 27, 2015, 5:41:55 PM7/27/15
to Phusion Passenger Discussions, hon...@phusion.nl
> Does this mean you are no longer experiencing the problem? 

I have done a fresh install, installed most of my other software and am now deciding between installing Passenger via yum or gem.

>This indicates that the Passenger module is not loaded into Apache

I wonder if the server administration software we use (Virtualmin) is causing a conflict or removing the passenger.con file..

>In normal circumstances you shouldn't have to bother inserting 'PassengerRoot' into httpd.conf. 

I want to use a different Ruby version (which I'll install with ruby-install and Chruby) for different apps. How else would we specify Rubies?

>The downsides are..

I am not too bothered by compilation time or installing dependencies and SElinux is disabled. Having said that, I appreciate the time you have taken to reply and I can see that you favour the yum install method... so I will give it another try.

Wish me luck!

Hongli Lai

unread,
Jul 27, 2015, 6:25:26 PM7/27/15
to Aston J, Phusion Passenger Discussions
On Mon, Jul 27, 2015 at 11:41 PM, Aston J <asto...@gmail.com> wrote:
> I want to use a different Ruby version (which I'll install with ruby-install
> and Chruby) for different apps. How else would we specify Rubies?

You would use PassengerRuby for that.

I was talking about PassengerRoot, not PassengerRuby. Here's how it
works. First, Apache must be configured to load the Passenger module.
This is done through two configuration options: "LoadModule
passenger_module /path-to-mod_passenger.so" and "PassengerRoot
/path-to-passenger".

Only with the appropriate "LoadModule" option will Apache load the
Passenger module, which allows Apache to recognize Passenger-related
config options. If this LoadModule option is not in place, then Apache
will fail to recognize Passenger-related config options.

Second, the PassengerRoot option is also required, in addition to
LoadModule. If you have LoadModule but not PassengerRoot, then the
Passenger module will be loaded into Apache (and so allows Apache to
recognize Passenger options), but the module will refuse to work.

Typically, the RPMs install /etc/httpd/conf.d/passenger.conf, which
contains both "LoadModule passenger_module ..." and "PassengerRoot
..."

PassengerRuby is a totally separate config option, which allows you to
customize the Ruby interpreter used on a per-application basis.

Aston J

unread,
Jul 28, 2015, 11:27:53 AM7/28/15
to Phusion Passenger Discussions, asto...@gmail.com
Hi Hongli

Just a quick note to say it worked!

Not sure what I was doing wrong before, but the only thing I did differently this time was install Passenger before installing Chruby and any other rubies (not sure if that would make a difference).

Thanks for all your help! :)
Reply all
Reply to author
Forward
0 new messages