- Actuellement stable – Installer la dernière version stable de Ruby
- Écurie précédente – Installer la version stable précédente de Ruby
Cet article vous aidera à
Étape 1 :Installez les packages requis
Tout d'abord, nous devons installer tous les packages requis pour l'installation de Ruby sur notre système à l'aide de la commande suivante.
# 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
Étape 2 :Installez RVM (Ruby Version Manager)
Installez la dernière version stable de RVM sur votre système à l'aide de la commande suivante. Cette commande téléchargera automatiquement tous les fichiers requis et les installera sur votre système.
# curl -Lget.rvm.io | bash -sstable
Configurez maintenant l'environnement système avant d'installer Ruby. Utilisez la commande ci-dessous pour configurer l'environnement rvm.
# source/etc/profile.d/rvm.sh
Étape 3 :Installer Ruby
Après avoir terminé la configuration de l'environnement RVM, installons le langage Ruby à l'aide de la commande suivante.
# rvm install2.0.0
[Exemple de sortie]
Searching for binary rubies, this might take some time. No binary rubies available for: centos/6/i386/ruby-2.0.0-p451. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for centos. Requirements installation successful. Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.0.0-p451, this may take a while depending on your cpu(s)... ruby-2.0.0-p451 - #downloading ruby-2.0.0-p451, this may take a while depending on your connection... ** Resuming transfer from byte position 24576 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10.2M 100 10.2M 0 0 188k 0 0:00:55 0:00:55 --:--:-- 414k ruby-2.0.0-p451 - #extracting ruby-2.0.0-p451 to /usr/local/rvm/src/ruby-2.0.0-p451... ruby-2.0.0-p451 - #applying patch /usr/local/rvm/patches/ruby/changeset_r45225.diff. ruby-2.0.0-p451 - #applying patch /usr/local/rvm/patches/ruby/changeset_r45240.diff. ruby-2.0.0-p451 - #applying patch /usr/local/rvm/patches/ruby/ssl_no_ec2m.patch. ruby-2.0.0-p451 - #configuring.................................................. ruby-2.0.0-p451 - #post-configuration. ruby-2.0.0-p451 - #compiling............................................................................ ruby-2.0.0-p451 - #installing............................. ruby-2.0.0-p451 - #making binaries executable.. ruby-2.0.0-p451 - #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 96653 0 0:00:04 0:00:04 --:--:-- 136k No checksum for downloaded archive, recording checksum in user configuration. ruby-2.0.0-p451 - #extracting rubygems-2.2.2... ruby-2.0.0-p451 - #removing old rubygems......... ruby-2.0.0-p451 - #installing rubygems-2.2.2............... ruby-2.0.0-p451 - #gemset created /usr/local/rvm/gems/[email protected] ruby-2.0.0-p451 - #importing gemset /usr/local/rvm/gemsets/global.gems..................................... ruby-2.0.0-p451 - #generating global wrappers......... ruby-2.0.0-p451 - #gemset created /usr/local/rvm/gems/ruby-2.0.0-p451 ruby-2.0.0-p451 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list ruby-2.0.0-p451 - #generating default wrappers......... ruby-2.0.0-p451 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.0.0-p451 - #complete Please be aware that you just installed a ruby that requires 2 patches just to be compiled on an up to date linux system. This may have known and unaccounted for security vulnerabilities. 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
Étape 4 :Configurer la version Ruby par défaut
Utilisez la commande rvm pour configurer la version ruby par défaut à utiliser par les applications.
#rvm use 2.0.0 --default Using /usr/local/rvm/gems/ruby-2.0.0-p451
En utilisant la commande suivante, vous pouvez vérifier que la version actuelle de ruby est utilisée.
# ruby --version ruby 2.0.0p451 (2014-02-24 revision 45167) [i686-linux]
Félicitations, vous avez réussi à installer Ruby sur votre système. Lisez notre prochain article pour intégrer Ruby au serveur Web Apache en quelques étapes simples.
Références :
1. http://rvm.io/rubies/installing