How to install Ruby 2.2 On CentOS 7
To install Ruby 2.2 on CentOS 7
Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. Since Ruby is a high level language, it abstracts away most of the complex details of the machine. Thus, you can quickly build something from scratch with less lines of code. Ruby 2.2 is one of the latest versions of the programming language, and this article covers the ground on the installation process of Ruby 2.2 on CentOS 7.
Installing Ruby 2.2
In order to install Ruby, make sure you add the required repository before you start with the installation process. You shall perform this action by executing the following command.
[root@linuxhelp1 ~]# yum install centos-release-scl-rh centos-release-scl -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* extras: mirror.dhakacom.com
* updates: mirror.dhakacom.com
Resolving Dependencies
--> Running transaction check
---> Package centos-release-scl.noarch 0:2-2.el7.centos will be installed
---> Package centos-release-scl-rh.noarch 0:2-2.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================
Installing:
centos-release-scl noarch 2-2.el7.centos extras 12 k
centos-release-scl-rh noarch 2-2.el7.centos extras 12 k
Transaction Summary
============================================================================================================================================
Install 2 Packages
Total download size: 24 k
Installed size: 39 k
Downloading packages:
(1/2): centos-release-scl-rh-2-2.el7.centos.noarch.rpm | 12 kB 00:00:01
(2/2): centos-release-scl-2-2.el7.centos.noarch.rpm | 12 kB 00:00:02
--------------------------------------------------------------------------------------------------------------------------------------------
Total 8.4 kB/s | 24 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : centos-release-scl-rh-2-2.el7.centos.noarch 1/2
Installing : centos-release-scl-2-2.el7.centos.noarch 2/2
Verifying : centos-release-scl-rh-2-2.el7.centos.noarch 1/2
Verifying : centos-release-scl-2-2.el7.centos.noarch 2/2
Installed:
centos-release-scl.noarch 0:2-2.el7.centos centos-release-scl-rh.noarch 0:2-2.el7.centos
Complete!
Once the repo is added, you shall directly proceed with the installation process.
[root@linuxhelp1 ~]# yum install rh-ruby22 -y
Loaded plugins: fastestmirror, langpacks
centos-sclo-rh | 2.9 kB 00:00:00
centos-sclo-sclo | 2.9 kB 00:00:00
(1/2): centos-sclo-sclo/x86_64/primary_db | 189 kB 00:00:00
(2/2): centos-sclo-rh/x86_64/primary_db | 2.9 MB 00:00:09
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* extras: mirror.dhakacom.com
* updates: mirror.dhakacom.com
Resolving Dependencies
--> Running transaction check
---> Package rh-ruby22.x86_64 0:2.0-6.sc1.el7 will be installed
--> Processing Dependency: rh-ruby22-runtime for package: rh-ruby22-2.0-6.sc1.el7.x86_64
--> Processing Dependency: rh-ruby22-ruby for package: rh-ruby22-2.0-6.sc1.el7.x86_64
--> Running transaction check
---> Package rh-ruby22-ruby.x86_64 0:2.2.2-16.el7 will be installed
--> Processing Dependency: rh-ruby22-ruby-libs(x86-64) = 2.2.2-16.el7 for package: rh-ruby22-ruby-2.2.2-16.el7.x86_64
--> Processing Dependency: rh-ruby22-rubygem(bigdecimal) > = 1.2.6 for package: rh-ruby22-ruby-2.2.2-16.el7.x86_64
--> Processing Dependency: rh-ruby22-ruby(rubygems) > = 2.4.5 for package: rh-ruby22-ruby-2.2.2-16.el7.x86_64
--> Processing Dependency: libruby.so.2.2()(64bit) for package: rh-ruby22-ruby-2.2.2-16.el7.x86_64
---> Package rh-ruby22-runtime.x86_64 0:2.0-6.sc1.el7 will be installed
--> Running transaction check
---> Package rh-ruby22-ruby-libs.x86_64 0:2.2.2-16.el7 will be installed
---> Package rh-ruby22-rubygem-bigdecimal.x86_64 0:1.2.6-16.el7 will be installed
---> Package rh-ruby22-rubygems.x86_64 0:2.4.5-16.el7 will be installed
.
.
.
Installed:
rh-ruby22.x86_64 0:2.0-6.sc1.el7
Dependency Installed:
libyaml.x86_64 0:0.1.4-11.el7_0 rh-ruby22-ruby.x86_64 0:2.2.2-16.el7
rh-ruby22-ruby-irb.noarch 0:2.2.2-16.el7 rh-ruby22-ruby-libs.x86_64 0:2.2.2-16.el7
rh-ruby22-rubygem-bigdecimal.x86_64 0:1.2.6-16.el7 rh-ruby22-rubygem-io-console.x86_64 0:0.4.3-16.el7
rh-ruby22-rubygem-json.x86_64 0:1.8.1-16.el7 rh-ruby22-rubygem-psych.x86_64 0:2.0.8-16.el7
rh-ruby22-rubygem-rdoc.noarch 0:4.2.0-16.el7 rh-ruby22-rubygems.x86_64 0:2.4.5-16.el7
rh-ruby22-runtime.x86_64 0:2.0-6.sc1.el7
Complete!
Now that the installation is complete, you shall set your environment variable by running the following command.
[root@linuxhelp1 ~]# scl enable rh-ruby22 bash
You can also check the version of your ruby application with the help of the following command.
[root@linuxhelp1 ~]# ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
With this, the installation of Ruby comes to an end.
Comments ( 0 )
No comments available