ok, this is ancient, but I think still relevant.
the output you pasted does not clearly state the error, but my feeling is that you hit a permission error.
I am making these assumptions:
- your ruby is installed as system package
- your GEM_ROOT is /usr/local/lib/ruby/gems/
- you run the gem install command as a regular user.
you can give write access to your GEM_ROOT folder to a specific user group
and have your unix user be part of one group. or like most people do, use sudo.
although I recommend against install ruby via system package and gems as root. you will endup compiling C code by root which is not recommended.
you should have your web user install rvm, this way you can have multiple ruby installed under his home directly.
gems will instead more easily too.
then you configure your apache/nginx to point to those directories
Define RVM_ROOT /usr/local/rvm/gems
Define RVM_WRAPPERS /usr/local/rvm/wrappers
Define RUBY_23 ruby-2.3.7
Define RUBY_24 ruby-2.4.2
Define APACHE_ETC /etc/httpd
Define PASSENGER_RUBY ruby-2.4.2
Define PASSENGER_VERSION 5.1.10
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.4.2/gems/passenger-5.1.10/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot ${RVM_ROOT}/${PASSENGER_RUBY}/gems/passenger-${PASSENGER_VERSION}
PassengerDefaultRuby ${RVM_WRAPPERS}/${PASSENGER_RUBY}/ruby
PassengerLogLevel 1
</IfModule>
<VirtualHost *:443>
DocumentRoot "/opt/www/app/public"
# Turn on Passenger
PassengerEnabled on
PassengerAppRoot /opt/www/app
PassengerLogLevel 2
PassengerLogFile /var/log/passenger.log
PassengerAppEnv production
PassengerPreStart https://app.com
SetEnv GEM_HOME ${RVM_ROOT}/ruby-2.4.2
SetEnv GEM_PATH ${RVM_ROOT}/ruby-2.4.2:${RVM_ROOT}/ruby-2.4.2@global
PassengerRuby ${RVM_ROOT}/ruby-2.4.2/wrappers/ruby
RailsEnv production
</VirtualHost>