Installing Phusion Passenger 4.0.20 on Ubuntu 13.10

So I'm trying to install Passenger on the newest version of KUbuntu (13.10). I installed Apache2 using the apache2-mpm-worker package using the Muon Package Manager. And these are the commands I ran.

rvmsudo gem install passenger
rvmsudo passenger-install-apache2-module

But I keep getting the following errors:

[Fri Oct 18 15:52:13.227790 2013] [core:warn] [pid 13095] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined                        
[Fri Oct 18 15:52:13.227933 2013] [core:warn] [pid 13095] AH00111: Config variable ${APACHE_PID_FILE} is not defined                        
[Fri Oct 18 15:52:13.227969 2013] [core:warn] [pid 13095] AH00111: Config variable ${APACHE_RUN_USER} is not defined                        
[Fri Oct 18 15:52:13.227991 2013] [core:warn] [pid 13095] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined                       
[Fri Oct 18 15:52:13.228026 2013] [core:warn] [pid 13095] AH00111: Config variable ${APACHE_LOG_DIR} is not defined                         
[Fri Oct 18 15:52:13.231737 2013] [core:warn] [pid 13095:tid 3074562624] AH00111: Config variable ${APACHE_RUN_DIR} is not defined          
[Fri Oct 18 15:52:13.232760 2013] [core:warn] [pid 13095:tid 3074562624] AH00111: Config variable ${APACHE_LOG_DIR} is not defined          
[Fri Oct 18 15:52:13.233043 2013] [core:warn] [pid 13095:tid 3074562624] AH00111: Config variable ${APACHE_LOG_DIR} is not defined          
[Fri Oct 18 15:52:13.233078 2013] [core:warn] [pid 13095:tid 3074562624] AH00111: Config variable ${APACHE_LOG_DIR} is not defined          
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:                                                                              
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}                                                                                 

--------------------------------------------                                                                                                

WARNING: Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM

Phusion Passenger has only been tested on Apache with the 'prefork', the                                                                    
'worker' and the 'event' MPM. Your Apache installation is compiled with                                                                     
the '' MPM. We recommend you to abort this installer and to recompile                                                                       
Apache with either the 'prefork', the 'worker' or the 'event' MPM.                                                                          

Press Ctrl-C to abort this installer (recommended).
Press Enter if you want to continue with installation anyway.

The result of my running apache2ctl -V is:

Server version: Apache/2.4.6 (Ubuntu)
Server built:   Aug  9 2013 14:31:04
Server's Module Magic Number: 20120211:23
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   32-bit
Server MPM:     worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

As can be seen, the server is compiled with the worker MPM, so why is passenger complaining? And how do I solve the above errors (warnings, really, but to be safe, I'd like to not have any warnings)?

Thanks.


Solution 1:

This is due to some missing environment variables. Try to run this first:

$ rvmsudo $SHELL
# source /etc/apache2/envvars
# export HOME=/home/USRNAME

This script sets the missing variables (change USRNAME accordingly).

Solution 2:

I see that you already solved this problem but for other people... Passenger now ships precompiled binaries for last ubuntu distribution, so there's no need to precompile with passenger-install-apache2-module on every upgrade.

I followed this instructions and it worked for me: http://www.modrails.com/documentation/Users%20guide%20Apache.html#install_on_debian_ubuntu