GNU/Linux >> Linux Esercitazione >  >> Cent OS

Installa Ruby 1.9.3 (o Multiple Ruby Version) su CentOS, RedHat usando RVM

Avviso – Ruby 1.9 è arrivato a fine vita e non più mantenuto. Si prega di utilizzare i tutorial di seguito per installare l'ultima versione di ruby

  • Attuale stabile – Installa l'ultima versione stabile di Ruby
  • Precedente stabile – Installa la versione stabile precedente di Ruby

Il linguaggio di programmazione Ruby sta diventando sempre più popolare in questi giorni. Il linguaggio Ruby è stato creato da Yukihiro "Matz" Matsumoto e pubblicato per la prima volta nel 1995. Questo articolo ti aiuterà a installare il linguaggio Ruby in CentOS, sistema RedHat usando RVM. Per questo articolo sto usando CentOS 6.5. RVM fornisce un semplice set di comandi per installare versioni singole o multiple di Ruby su un singolo server.

Fase 1:aggiornamento dei pacchetti

È consigliabile mantenere aggiornato il sistema con i pacchetti più recenti. Prima di eseguire il comando sotto, assicurati che l'aggiornamento non influisca sulle tue app in esecuzione (se presenti) sul server, altrimenti saltalo

# yum update

Fase 2:installazione dei pacchetti consigliati

Ci sono poche librerie di sviluppo richieste per eseguire Ruby su Linux. Usa il seguente comando per installare i pacchetti consigliati sul tuo server usando yum.

# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel

Fase 3:Installa RVM (Ruby Version Manager)

Installa l'ultima versione stabile di RVM sul tuo sistema usando il seguente comando. Questo comando scaricherà automaticamente tutti i file richiesti e li installerà sul tuo sistema.

# curl -L get.rvm.io | bash -s stable

[Risultato di esempio]

  % 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

Fase 4:configurazione dell'ambiente RVM

Dopo aver installato RVM prima, dobbiamo configurare l'ambiente rvm usando il comando seguente.

# source /etc/profile.d/rvm.sh

Passaggio 5:installa la versione Ruby richiesta

RVM offre l'opzione per gestire più versioni di ruby ​​su un singolo sistema. Usa il seguente comando per installare la versione richiesta di Ruby.

# rvm install 1.9.3

[Risultato di esempio]

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

Fase 6:installa un'altra versione ( se richiesto)

Se vuoi usare più versioni di ruby, puoi installarlo anche usando rvm altrimenti salta questo passaggio.

# rvm install 1.8.6

Passaggio 7:imposta la versione Ruby predefinita

Usa il comando rvm per impostare la versione predefinita di ruby ​​da utilizzare per le applicazioni.

# rvm use 1.9.3 --default 

Using /usr/local/rvm/gems/ruby-1.9.3-p545
Fase 8:verifica la versione attuale di Ruby

Usando il comando seguente puoi verificare che sia utilizzata la versione corrente di Ruby.

# ruby --version

ruby 1.9.3p545 (2014-02-24 revision 45159) [i686-linux]

Spero che i passaggi precedenti ti aiutino a installare più versioni di Ruby utilizzando RVM.


Cent OS
  1. Come installare l'ultima versione di Python 3 su CentOS 7

  2. Come installare Ruby on Rails su CentOS 8

  3. Come installare MongoDB 4.2 / 4.0 su CentOS 6 / RHEL 6

  4. Come installare Ruby 2.0.0 su CentOS e RHEL 6 usando RVM

  5. Installa MongoDB su un VPS CentOS

Installa Ruby on Rails su Ubuntu 16.04 / CentOS 7 / Fedora 26 usando rbenv

Come installare PHP 7.4 su CentOS 8

Come installare Ruby Version Manager (RVM) su Debian 11 Bullseye

Come installare Ruby on Rails su CentOS 7

Come installare PhpStorm su CentOS 8

Come installare Ruby on Rails su CentOS 8