GNU/Linux >> Belajar Linux >  >> Cent OS

Cara Menginstal Ruby 2.0.0 di CentOS &RHEL 6 menggunakan RVM

Peringatan – Ruby 2.0 telah mencapai akhir masa pakainya dan tidak lagi dipertahankan. Silakan gunakan tutorial di bawah ini untuk menginstal ruby ​​versi terbaru

  • Stabil saat ini – Instal Ruby Rilis Stabil Terbaru
  • Stabil sebelumnya – Instal Ruby Rilis Stabil Sebelumnya

Ruby adalah bahasa pemrograman berorientasi objek yang dinamis. Kami menggunakan RVM, yang merupakan singkatan dari Ruby Version Manager, yang memudahkan penginstalan Ruby di platform Linux. RVM juga berguna untuk mengelola beberapa versi Ruby tanpa konflik, dan kita dapat mengalihkan sistem ke versi Ruby apa pun menggunakan satu perintah.

Artikel ini akan membantu Anda untuk Cara Menginstal Ruby 2.0.0 pada CentOS, Sistem RedHat menggunakan RVM. Untuk menginstal Ruby versi lain gunakan tautan berikut

Langkah 1:Instal Paket yang Diperlukan

Pertama kita perlu menginstal semua paket yang diperlukan untuk instalasi Ruby di sistem kita menggunakan perintah berikut.

# 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
Langkah 2:Instal RVM ( Ruby Version Manager )

Instal RVM versi stabil terbaru di sistem Anda menggunakan perintah berikut. Perintah ini akan secara otomatis mengunduh semua file yang diperlukan dan menginstal di sistem Anda.

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

Sekarang atur lingkungan sistem sebelum menginstal Ruby. Gunakan perintah di bawah ini untuk mengatur lingkungan rvm.

# source /etc/profile.d/rvm.sh
Langkah 3:Instal Ruby

Setelah menyelesaikan pengaturan lingkungan RVM, mari kita instal bahasa Ruby menggunakan perintah berikut.

# rvm install 2.0.0

[Contoh Keluaran]

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

Langkah 4:Siapkan Versi Ruby Default

Gunakan perintah rvm untuk mengatur versi ruby ​​default yang akan digunakan oleh aplikasi.

# rvm use 2.0.0 --default

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

Menggunakan perintah berikut, Anda dapat memeriksa versi ruby ​​​​yang digunakan saat ini.

# ruby --version

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

Selamat Anda telah berhasil menginstal Ruby di sistem Anda. Baca artikel kami berikutnya untuk mengintegrasikan Ruby dengan server web Apache dengan langkah mudah.

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


Cent OS
  1. Cara Menginstal Ruby on Rails di CentOS 8

  2. Instal Ruby 1.9.3 (atau Beberapa Versi Ruby) di CentOS, RedHat menggunakan RVM

  3. Cara Menginstal Ruby di CentOS/RHEL 8

  1. Cara menginstal phpMyAdmin di RHEL 8 / CentOS 8

  2. Cara Menginstal P7Zip di RHEL 8 / CentOS 8

  3. Cara menginstal ntfs-3g di RHEL 8 / CentOS 8

  1. Cara Menginstal PHP-mbstring di RHEL 8 / CentOS 8

  2. Cara menginstal phantomjs di RHEL 8 / CentOS 8

  3. Cara menginstal Dropbox di RHEL 8 / CentOS 8