Install Ruby later in Ubuntu

Source: Internet
Author: User
Install and uninstall Ruby in Ubuntu

In ubuntu12.04, run the following command to install Ruby 1.8 by default.

1 $ sudoapt-Get installruby

I. The following describes how to install ruby1.9.3 (in some versions of Linux, 1.8 must be installed first)

Install curl first. If you have installed curl, you will be prompted that curl is already in the latest version.

1 $ sudo apt-Get installcurl

Next, install the ruby version management tool (rvm)

1 $ curl-l get. rvm. Io | bash-s stable -- Ruby


If you enter rvm-V in the command line, the system prompts that you have not installed rvm because the rvm command cannot be found,
You just need to add the path to the path.

1 $ source ~ /. Rvm/scripts/rvm

Enter rvm-V to display the information, indicating that the installation is successful.

1rvm 1.15.8 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, 1 Michal Papis <mpapis@gmail.com> [https://rvm.io/]

Install ruby1.9.3

1 $ rvm install1.9.3

View installed Ruby versions

1 $ rvm list

The following information is displayed:

1234567rvm rubies = * ruby-1.9.3-p194 [x86_64] # =>-current # = *-current & default # *-Default

This indicates that ruby-1.9.3 is successfully installed.

2. rvm (Ruby version manager) is required for Ruby uninstallation ),
First, check which Ruby versions are installed on your system

1rvm list

Uninstall the version you need

1rvm remove ruby -******

Or

1rvm uninstall ruby -******

Finally, you can use the rvm list to check whether the version is uninstalled and you do not need it.


To install Ruby 1.9.2 using rvm on Ubuntu:

$ Sudo apt-Get install ruby-rvm

$ Sudo rvm get latest
$ Rvm reload
$ Rvm-V

$ Sudo rvm install 1.9.2

For the installation method, see read this before installing rails 3.1.

========================================================== ======================================

Usage:

$ Sudo rvm 1.9.2 exec gem install rails
$ Rvm 1.9.2 exec rails-V

$ Rvm 1.9.2 exec rails new first_app

For more information, see rvm usage.

========================================================== ======================================

Rvm can be installed with multiple versions of Ruby, but every time you use Ruby, you need to add an rvm prefix.

My idea: I will launch VMware later. Different Versions of Ruby and rails will be installed on different virtual machines.

========================================================== ======================================

2012.01.04 updated:

Earlier versions of Ruby 1.9.2 may encounter SSLv2 errors.

Ruby-1.9.2-p290 does not have this problem. No modification is required.

========================================================== ======================================

Ruby version description:

Ruby 1.9.2-p290 is newer than Ruby 1.9.2-p180

========================================================== ======================================

Earlier versions of Ruby 1.9.2 may encounter SSLv2 errors.

Ruby-1.9.2-p290 does not have this problem. No modification is required.

Question: When trying to install Ruby 1.9.2 using rvm I got a nasty suprise:

Ossl_ssl.c: 110: 1: Error: 'sslv2 _ method' undeclared here (not in a function)
Ossl_ssl.c: 111: 1: Error: 'sslv2 _ server_method 'undeclared here (not in a function)
Ossl_ssl.c: 112: 1: Error: 'sslv2 _ client_method 'undeclared here (not in a function)
Make [1]: *** [ossl_ssl.o] Error 1
Make [1]: Leaving directory '/var/Cache/ruby-rvm/src/ruby-1.9.2-p180/EXT/OpenSSL'
Make: *** [mkmain. Sh] Error 1

Solution:

Sudo apt-Get install ruby-rvm

# Make sure we have $ rvm_path
Source/etc/profile

# 1st try wowould fail with above error message
Rvm install 1.9.2

VI/var/Cache/ruby-rvm/src/ruby-1.9.2-p180/EXT/OpenSSL $ VI ossl_ssl.c
Remove 3 lines and save

Ossl_ssl_method_entry (SSLv2 ),
Ossl_ssl_method_entry (sslv2_server ),
Ossl_ssl_method_entry (sslv2_client ),

# Try again
Rvm install 1.9.2

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.