- Estable actual – Instale la última versión estable de Ruby
- Establo anterior: Instale la versión estable anterior de Ruby
El lenguaje de programación Ruby se está volviendo más popular en estos días. El lenguaje Ruby fue creado por Yukihiro "Matz" Matsumoto y se publicó por primera vez en 1995. Este artículo lo ayudará a instalar el lenguaje Ruby en CentOS, sistema RedHat usando RVM. Para este artículo estoy usando CentOS 6.5. RVM proporciona un conjunto sencillo de comandos para instalar una o varias versiones de Ruby en un solo servidor.
Paso 1:Paquetes de actualización
Es la mejor práctica mantener su sistema actualizado con los paquetes más recientes. Antes de ejecutar el siguiente comando, asegúrese de que la actualización no afectará a sus aplicaciones en ejecución (si las hay) en el servidor; de lo contrario, omítalo
# yumupdate
Paso 2:Instalación de paquetes recomendados
Se requieren pocas bibliotecas de desarrollo para ejecutar Ruby en Linux. Use el siguiente comando para instalar paquetes recomendados en su servidor usando yum.
# yuminstall gcc-c++ patch readline readline-devel zlib zlib-devel # yuminstall libyaml-devel libffi-devel openssl-devel make # yuminstall bzip2 autoconf automake libtool bison iconv-devel
Paso 3:Instale RVM (Administrador de versiones de Ruby)
Instale la última versión estable de RVM en su sistema usando el siguiente comando. Este comando descargará automáticamente todos los archivos requeridos y los instalará en su sistema.
# curl -Lget.rvm.io | bash -sstable
[Salida de muestra]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20511 100 20511 0 0 1120 0 0:00:18 0:00:18 --:--:-- 19722
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
Paso 4:Configuración del entorno RVM
Después de instalar RVM, primero debemos configurar el entorno rvm usando el siguiente comando.
# source/etc/profile.d/rvm.sh
Paso 5:Instale la versión Ruby requerida
RVM brinda la opción de administrar múltiples versiones de Ruby en un solo sistema. Use el siguiente comando para instalar la versión requerida de Ruby.
# rvm install1.9.3
[Salida de muestra]
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/i386/ruby-1.9.3-p545.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Updating system......
Installing required packages: libyaml-devel......
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p545, this may take a while depending on your cpu(s)...
ruby-1.9.3-p545 - #downloading ruby-1.9.3-p545, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9802k 100 9802k 0 0 217k 0 0:00:45 0:00:45 --:--:-- 393k
ruby-1.9.3-p545 - #extracting ruby-1.9.3-p545 to /usr/local/rvm/src/ruby-1.9.3-p545.
ruby-1.9.3-p545 - #applying patch /usr/local/rvm/patches/ruby/GH-488.patch.
ruby-1.9.3-p545 - #applying patch /usr/local/rvm/patches/ruby/ssl_no_ec2m.patch.
ruby-1.9.3-p545 - #configuring..............................................
ruby-1.9.3-p545 - #post-configuration.
ruby-1.9.3-p545 - #compiling...................................................................
ruby-1.9.3-p545 - #installing........................
ruby-1.9.3-p545 - #making binaries executable.
ruby-1.9.3-p545 - #downloading rubygems-2.2.2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 404k 100 404k 0 0 25393 0 0:00:16 0:00:16 --:--:-- 335k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-1.9.3-p545 - #extracting rubygems-2.2.2.
ruby-1.9.3-p545 - #removing old rubygems.
ruby-1.9.3-p545 - #installing rubygems-2.2.2...............
ruby-1.9.3-p545 - #gemset created /usr/local/rvm/gems/[email protected]
ruby-1.9.3-p545 - #importing gemset /usr/local/rvm/gemsets/global.gems.....
ruby-1.9.3-p545 - #generating global wrappers.
ruby-1.9.3-p545 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p545
ruby-1.9.3-p545 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.3-p545 - #generating default wrappers.
ruby-1.9.3-p545 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-1.9.3-p545 - #complete
WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
Paso 6:Instale otra versión (si es necesario)
Si desea usar varias versiones de ruby, puede instalarlo también usando rvm; de lo contrario, omita este paso.
# rvm install1.8.6
Paso 7:Configurar la versión predeterminada de Ruby
Use el comando rvm para configurar la versión predeterminada de Ruby para que la usen las aplicaciones.
#rvm use 1.9.3 --default Using /usr/local/rvm/gems/ruby-1.9.3-p545
Paso 8:Comprobar la versión actual de Ruby
Con el siguiente comando, puede comprobar que se utiliza la versión actual de Ruby.
# ruby --version ruby 1.9.3p545 (2014-02-24 revision 45159) [i686-linux]
Espero que los pasos anteriores lo ayuden a instalar varias versiones de Ruby usando RVM.