There are 2 problems:

   1. Even though installing ruby seems possible without source files (eg 
   ruby.h) using eg rvm, ruby-install etc, subsequently installing rails as a 
   gem requires these files. To avoid version mismatch with the versions from 
   your os (package manager eg yum, yast, apt) its best to build ruby from 
   source.
   2. nokogiri seems to have a bug. Installing rails as a ruby gem fails 
   because of nokogiri wanting to bring in its own version of some dev fies 
   (eg libxml2, libxslt). So you should install nokogiri separately first 
   explicitly telling it not to use these files.



*Download Ruby - build from source*

Make sure in your os package manager (yum, yast, apt etc) that you install 
any prerequisites for building c fies eg
c compiler, make, etc

Additionally make sure the following are installed:

#  libxml2-devel, libxslt-devel (for nokogiri)
#  nodejs for runtime (server)
 

> cd ~/declan/Downloads/ruby-2.2.3
 #create dir below first manually as user "declan" otherwise they will 
automatically get created belonging to root
> ./configure --prefix=/home/declan/dev/web_framework/rails/ruby/2.2.3/
> make
> sudo make install



*Dowload and install "chruby" * (https://github.com/postmodern/chruby)

# cd /home/declan/tmp/
wget -O chruby-0.3.9.tar.gz https:
//github.com/postmodern/chruby/archive/v0.3.9.tar.gz
tar -xzvf chruby-0.3.9.tar.gz
cd chruby-0.3.9/


# install (to local dir .. dont need sudo)
# dont use setup.sh ...see below

> PREFIX=/home/declan/dev/web_framework/rails/chruby/0.3.9/ make install


# !! *dont* do this since it adds a "chruby.h" file to /etc/profile.d/ 
which causes share/chruby/auto.sh to get run each system boot .. dont want 
this
# sudo /home/declan/tmp/chruby-0.3.9/scripts/setup.sh 
# by default installs to "/usr/local/share/chruby/"

# *edit chruby.sh* to tell it about our custom ruby
# /home/declan/dev/web_framework/rails/chruby/0.3.9/share/chruby/chruby.sh

RUBIES+=("/home/declan/dev/web_framework/rails/ruby/2.2.3/")


Now you have a clean locally installed version of rails (which is 
independent of any system version), which you can "activate via 

> source /home/declan/dev/web_framework/rails/chruby/0.3.9/share/chruby/
chruby.sh
> chruby 2.2.3
> ruby --version          # 2.2.3
> gem install rubygems-update  # update gem itself

 

One should be able to install rails as a gem now, but apparently nokogiri 
bringing its own versions of files like  libxml2-devel, libxslt-devel 
causes error messages like youre having, so manually install it first 
explicitly telling it not to use these:


> gem install nokogiri -- --use-system-libraries 

Now install rails itself

> gem install rails  
> rails --version
 Rails 4.2.4



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a020d959-5929-448a-ba5b-758a00b71adf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to