How do I install Ruby 1.9.3 on Ubuntu without RVM?
1st approach
Source
http://lenni.info/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/
The new Ubuntu release has just rolled around and with it a slew of new packages. Personally, I'm tracking the development of Ruby quite closely but the default Ruby on Ubuntu ist still the 1.8 series which I can't recommend. Ruby 1.9 has some performance improvements and 1.9.3 in particular a lot of them compared to 1.9.2.
However, as I have elaborated in a previous post getting the Ruby 1.9 series on Ubuntu without using RVM instead of 1.8 isn't all that easy. Please read the post if you are interested in the details.
The short version is: You can get Ruby 1.9.3-p0 by installing the ruby-1.9.1 package. (The package is called 1.9.1 because that is the ABI version.)
If you want to make Ruby 1.9 the default do the following:
sudo apt-get update
sudo apt-get install ruby1.9.1 ruby1.9.1-dev \
rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \ build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.9.1.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \
--slave /usr/bin/irb irb /usr/bin/irb1.9.1 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1
# choose your interpreter
# changes symlinks for /usr/bin/ruby , /usr/bin/gem
# /usr/bin/irb, /usr/bin/ri and man (1) ruby
sudo update-alternatives --config ruby
sudo update-alternatives --config gem
# now try
ruby --version
If you want to make this your exclusive Ruby and get rid of Ruby 1.8 follow the uninstallation instructions.
Edit: I found out today that there also is a package called ruby1.9.3 however that is just a proxy package that doesn't have any files itself and only depends on ruby1.9.1. Aptitude confirms this:
Ruby uses two parallel versioning schemes: the `Ruby library compatibility version' (1.9.1 for this package), which is similar to a library SONAME, and the 'Ruby version' (1.9.3 for this package). Ruby packages in Debian are named using the Ruby library compatibility version, which is sometimes confusing for users who do not follow Ruby development closely. This package depends on the ruby1.9.1 package, and provides compatibility symbolic links from 1.9.3 executables and manual pages to their 1.9.1 counterparts.
There doesn't seem to be a rubygems1.9.3.
2nd approach
Also This link i found useful its very simple and effective.
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
How to install Ruby 2 on Ubuntu without RVM
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz
tar -xvzf ruby-2.0.0-p451.tar.gz
cd ruby-2.0.0-p451/
./configure --prefix=/usr/local
make
sudo make install
from here How do I install ruby 2.0.0 correctly on Ubuntu 12.04?
UPDATE
for ruby 2.1.5
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
tar -xvzf ruby-2.1.5.tar.gz
cd ruby-2.1.5/
./configure --prefix=/usr/local
make
sudo make install
if you are still seeing an older ruby check your symlink ls -la /usr/bin/ruby
from hector
Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to:
sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
open new terminal and validate environment is clean from old RVM settings (should be no output):
env | grep rvm
if there was output, try to open new terminal, if it does not help then restart your computer.
install RVM:
\curl -L https://get.rvm.io |
bash -s stable --ruby --autolibs=enable --auto-dotfiles
If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanation.
Error while installing Ruby 1.9.3
I had to upgrade RVM.
rvm get head
rvm reload
rvm install 1.9.3-p194
rvm use 1.9.3
If 1.9.3-p194 isn't the latest version (as of 06/07/2012), go to Ruby site to find out what is.
Install ruby-rvm on Ubuntu 11.10 with ruby 1.9.3
Please use this answer: Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
Your question is not duplicate, but the answer is the same.
error installing ruby 1.9.3 on linux server
I think your issue is that, since RVM is trying to compile ruby with the command __rvm_make -j48
(which tells the compiler to try to parallelize the compilation across 48 different jobs), your host system is running out of space to do so. Before I get to a possible solution, here are some high-level thoughts:
Production systems generally shouldn't be compiling their own Ruby versions. Instead, ship the compiled binaries to the node (e.g., as a Debian package) and don't even install RVM.
rvm
does a lot of magic to try and hide the details of what its doing from the end-user, but in my experience that's more trouble than it's worth. Use chruby or rbenv and build Ruby only when you need to.
Anyway, for your current issue, I think your best bet is to try to override the -j
flag to a smaller value. There are a few methods, but first try this:
rvm install 1.9.3 -j 1 # from http://cheat.errtheblog.com/s/rvm
If that doesn't help, double-check that the -j
argument in __rvm_make -j 48
actually changed to 1 in the log. If it did, try a smaller number. If it didn't, then try this:
MAKEFLAGS=-j1 rvm install ruby-1.9.3 # from https://twitter.com/avdi/status/130720270733410305
Hopefully one of those works!
Related Topics
How to Access Class Variables in Ruby 1.9
How to Use Ruby " Case ... When " with Inequalities
Differencebetween "Be_True" and "Be True" in Rspec
Aptana 3 Ruby Debugger - Exception in Debugthread Loop: Undefined Method 'Is_Binary_Data'
Rails Console Not Working on Server
Deleting While Iterating in Ruby
How to Parse Consecutive Tags with Nokogiri
Ruby Regex - Gsub Only Captured Group
Ruby Bundle Install Require: No Such Files to Load Error
What Does Class Classname < ::Otherclassname Do in Ruby
Is Alias_Method_Chain Synonymous with Alias_Method
How to Split a String into Only Two Parts, by the Last Occurrence of the Split Char
Rails/Rspec: How to Test #Initialize Method
Natural Language Date Parser for Ruby/Rails
Removing Child Root Nodes in Rabl
Ruby Split String by Repeating Characters or a Space