Ruby Installation - Unix

Here are the steps to be followed to install Ruby on a Unix machine −

NOTE − Before proceeding, make sure you have root privilege.

  • Download a zipped file having latest version of Ruby. Follow Download Link.

  • After having downloaded the Ruby archive, unpack it and change into the newly created directory −

$ tar -xvzf ruby-1.6.7.tgz
$ cd ruby-1.6.7
  • Now, configure and compile the source code as follows −
$ ./configure
$ make
  • Finally, install Ruby interpreter as follows −
$ su -l root # become a root user
$ make install
$ exit       # become the original user again
  • After installation, make sure everything is working fine by issuing the following command on the command-line −

$ruby -v
ruby 1.6.7 (2002-06-04) [i386-netbsd]
  • If everything is fine, this should output the version of the installed Ruby interpreter as shown above. You may have installed different version, so it will display a different version.

Using yum to Install Ruby

If your computer is connected to the Internet, then the easiest way to install Ruby or any other other RPM is using the yum utility. Give the following command at the command prompt and you will find Ruby gets installed on your computer.

$ yum install ruby