How to install Ruby and rvm on Ubuntu 11.04

  
                

rvm as a command-line tool, can provide a lot of convenience, is an inaccessible tool, you need to install Ruby before installing rvm, the following small series will take Ubuntu 11.04 as an example, to introduce Ubuntu 11.04 to install Ruby and rvm Way, let's learn together.

What is rvm?

The full name of rvm is Ruby Version Manager, a command-line tool developed by Wayne E. Seguin. Rvm makes it easy to install and manage the ruby ​​productivity environment, such as different versions of interpreters and gems.

Installing rvm

We will only discuss single-user installation here, that is, install rvm into the user's home folder. At the same time, our environment is Ubuntu 11.04.

rvm needs to download a setup script via the curl tool to install it. At the same time, the downloaded script also needs to use git to download the source from GitHub. Therefore, users who do not have curl and git installed need to execute the following command:

sudo apt-get install curl git

Everything is available, download and execute the installation script via curl (please do not use Root execution):

$ bash "(curl -s https://rvm.beginrescueend.com/install/rvm)

After you finish, you can see a lot of information. Describe how to proceed with the installation. In previous versions of the installation, you had to add configuration information to the ~/.bashrc file yourself, but now the installation script intelligently completes this step for you. You can refer to the setup_user_profiles() function in ~.rvm/src/rvm/scripts/funcionts/installer.

But it's a good idea to check if your .bashrc has the following configuration information:

[[ -s “$HOME/.rvm/scripts/rvm” ]] && Source “$HOME/.rvm/scripts/rvm” # Load RVM into a shell session *as a function*

Reopen the terminal (so let him reload the .bashrc file) and confirm that rvm is already installed. :

$ rvm -v

rvm 1.6.25 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]

rvm is here and the installation is complete.

Installing Ruby

Before installing ruby, you need to install some necessary dependencies:

$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git -core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

Then readline, before you manually compile This step:

$ rvm pkg install readline

Install ruby-1.9.2-p290, of course, you can also install the version you need, rvm will automatically download and compile for you: < Br>

$ rvm install 1.9.2-p290 --with-readline-dir=$rvm_path/usr

View the installed ruby ​​environment:

View already installed Ruby environment:

$ rvm list

rvm rubies

ruby-1.9.2-p290 [ i386 ]

will be installed ruby-1.9. 2-p290 is set to the default working environment:

$ rvm --default use 1.9.2-p290

Ubuntu 11.04 installation method is Ruby and rvm introduced, rvm tool you can download from the official website, can find their own online resources, you need to install Ruby.

Copyright © Windows knowledge All Rights Reserved