Install Ruby 1.9.2 on Ubuntu

Source: Internet
Author: User
Tags ruby on rails

First of all, 2012 years, already have Ruby 1.9.3, why I want to install 1.9.2.

Answer: Because I'm learning Ruby on Rails, the reference book Ruby on RAISL 3 tutorial is written according to 1.9.2, and Heroku server seems to support only Ruby 1.9.2

Start Ubuntu and install some related libraries with the following command

$ sudo apt-get install gcc g++ build-essential libssl-dev libreadline-gplv2-dev zlib1g-dev linux-headers-generic


Download the latest (or appropriate) Ruby 1.9.2 source

View: ftp://ftp.ruby-lang.org/pub/ruby/1.9/

or view: http://ftp.ruby-lang.org/pub/ruby/1.9/

$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz


Compile and install Ruby

$ TAR-ZXF ruby-1.9.2-p290.tar.gz

$ CD ruby-1.9.2-p290

$./configure--prefix=/usr/local/ruby

$ make && sudo make install


Environment settings

$ sudo vi/etc/environment

Add Ruby's path to the environment variable and save the/etc/environment, as follows:
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"
After you have modified the environment variable file, you need to make the change come into effect with the source command as follows:
$ source/etc/environment

To verify that the installation was successful, you can enter the following command to test:
$ruby –v


After confirming the success of the installation, you can add the command link by command, and I am not sure what the purpose of creating these links is, according to the principle of ruby "convention greater than configuration", it should be a convention. (Keyboardota)
$ sudo ln-s/usr/local/ruby/bin/ruby/usr/local/bin/ruby
$ sudo ln-s/usr/local/ruby/bin/gem/usr/bin/gem

You can now experience ruby in 20 minutes.


Reference: Install Ruby on Rails on Ubuntu


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.