1

I am tryng to install ruby on rails in centos server on AWS. I can't install rails on the server. It is giving some error. Here is what I am getting while installing rails.

#gem install rails
   ERROR:  Error installing rails:
    gzip error installing /usr/local/lib/ruby/gems/1.8/cache/activesupport-3.0.8.gem
ArunS
  • 315

3 Answers3

1
  1. Make sure you have Ruby 1.9.2 installed. Rails 3 requires Ruby 1.8.7 or 1.9.2. Ruby-1.9.2 has a better performance.
  2. Use "file" to determine the type of the 'gem' file you downloaded
  3. If possible, use 'rvm' to install and manage Ruby, Rails and other gems. Warning: compilation on AWS is slow.
inntran
  • 171
  • 3
1

Install zlib-devel package on S.O. and recompile your ruby version

0

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>