ubuntu 11.04 ruby 1.9.1 install

nstalled 1.9.1 using Synaptic. To my surprise, it installed 1.9.2!.

$ ruby1.9.1 -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

Now I do not like to call ruby like
$ ruby1.9.1 xxxxxx.rb

So I just created a symlink.
$ sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

                                        • -

マニュアルなら

Install Debian libraries needed to build Ruby 1.9

Login to the root account, then install the following Debian packages:
# apt-get install build-essential zlib1g zlib1g-dev libreadline5 libreadline5-dev libssl-dev


Get the source code for Ruby 1.9 and extract it, cd to a directory where you can build the software, then get the source code and extract it:
# wget ftp://ftp.ruby-lang....9.2-p290.tar.gz
# tar xvfz ruby-1.9.2-p290.tar.gz

cd into the source directory, then build and install Ruby 1.9

# cd ruby-1.9.2-p290
# ./configure --prefix=/usr/local/bin/ruby-1.9.2-p290 --enable-pthread --enable-shared
# make
# make install


Create a symbolic link in the deployment directory
# ln -s /usr/local/bin/ruby-1.9.2-p290/ /usr/local/bin/rubydir


Add new ruby bin directory to PATH variable in both the .bashrc and .profile files, for root user and other users. Add the following line to both the .bashrc and .profile configuration files for both the root user and any other user requiring access to Ruby:

export PATH=/usr/local/bin/rubydir/bin:$PATH


then either # source .bashrc .profile or log out and then log back in to an account where the config file change was made, for the new PATH definition to take effect. It is important that you add this new PATH definition for the root user, because root will need to know this when you run certain Ruby commands with sudo (such as installing gems.) If you want to give all users on the system access to Ruby, you need only place this PATH redefinition in /etc/bash.bashrc (/etc/profile references the PATH in /etc/bash.bashrc.)

Update the Gem utility

# gem update --system


Test it

# ruby -v

# gem -v


That's it, you now have a fully functioning Ruby 1.9 environment on your Debian or Debian-based system.