Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install Ruby 1.9.3 on Ubuntu without RVM?

I want to install ruby 1.9.3 on Ubuntu without rvm

I run

sudo apt-get install ruby

It's taking ruby 1.8 and ruby 1.9.1.

And if I do

sudo apt-get install ruby 1.9.3 -p XXXX

I am still not able to install ruby. How can I install ruby on Ubuntu?

like image 825
SSP Avatar asked Jun 18 '12 06:06

SSP


People also ask

How do I install a specific version of Ruby?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.

How do I download and install Ruby on Ubuntu?

Installing Ruby from Ubuntu Repositories The easiest way to install Ruby on Ubuntu is by using the apt package manager. At the time of writing, the version in the Ubuntu repositories is 2.7. 0 , which may not always be the latest stable release. Your Ruby version may differ from the one shown above.

What is RVM in Ubuntu?

RVM package for Ubuntu RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.


3 Answers

On Ubuntu 12.04 LTS, I got it to work with the following:

sudo apt-get install ruby 1.9.3
cd /etc/alternatives
sudo ln -sf /usr/bin/ruby1.9.3 ruby
like image 58
genegc Avatar answered Oct 08 '22 08:10

genegc


Use the brightbox packages for 1.9.3. You will have to add their repo though but to keep it short here just use their help pages: http://blog.brightbox.co.uk/posts/next-generation-ruby-packages-for-ubuntu

like image 30
three Avatar answered Oct 08 '22 09:10

three


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/

like image 32
SSP Avatar answered Oct 08 '22 10:10

SSP