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

Come installare Ruby 2.0.0 su CentOS e RHEL 6 usando RVM

Avviso – Ruby 2.0 è stato raggiunto 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

Rubino è un linguaggio di programmazione dinamico e orientato agli oggetti. Stiamo utilizzando RVM, che sta per Ruby Version Manager, che semplifica l'installazione di Ruby su piattaforma Linux. RVM è utile anche per gestire più versioni di Ruby senza conflitti e possiamo passare dal sistema a qualsiasi versione di Ruby usando un singolo comando.

Questo articolo ti aiuterà a Installare Ruby 2.0.0 su CentOS, sistemi RedHat che utilizzano RVM. Per installare altre versioni di Ruby usa i seguenti link

Passaggio 1:installa i pacchetti richiesti

Per prima cosa dobbiamo installare tutti i pacchetti richiesti per l'installazione di Ruby sul nostro sistema usando il seguente comando.

# 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 2: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

Ora configura l'ambiente di sistema prima di installare Ruby. Utilizzare il comando seguente per configurare l'ambiente rvm.

# source /etc/profile.d/rvm.sh
Fase 3:installa Ruby

Dopo aver completato la configurazione dell'ambiente RVM, installiamo il linguaggio Ruby usando il seguente comando.

# rvm install 2.0.0

[Risultato di esempio]

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

Fase 4:imposta la versione Ruby predefinita

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

# rvm use 2.0.0 --default

Using /usr/local/rvm/gems/ruby-2.0.0-p451

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

# ruby --version

ruby 2.0.0p451 (2014-02-24 revision 45167) [i686-linux]

Congratulazioni per aver installato con successo Ruby sul tuo sistema. Leggi il nostro prossimo articolo per integrare Ruby con il server web Apache con semplici passaggi.

Riferimenti:
1. http://rvm.io/rubies/installing


Cent OS
  1. Come installare phpMyAdmin su RHEL 8 / CentOS 8

  2. Come installare P7Zip su RHEL 8 / CentOS 8

  3. Come installare Ruby on Rails su CentOS 8

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

  5. Come installare Ruby su CentOS/RHEL 8

Come installare Maven su RHEL 8 / CentOS 8

Come installare Ruby su RHEL 8 / CentOS 8

Come installare Ruby su CentOS 7

Come installare Ruby on Rails su CentOS 8 / RHEL 8

Come installare Ruby on Rails su CentOS 7 / RHEL 7

Come installare flameshot su RHEL/CentOS usando Snapcraft