Install Ruby 2.5 on CentOS 7 using SCL


I tried this and that to establish how to install ruby.


1. Install CentOS SCL


# yum install -y centos-release-scl

2. Install the developer tools


# yum group install -y "Development Tools"

3. Install the required libraries


# yum install -y zlib-devel
# yum install -y ImageMagick ImageMagick-devel

4. Install ruby2.5


# yum install -y rh-ruby25 rh-ruby25-ruby-devel

5. Make ruby2.5 libraries loadable from shared libraries


# echo '/opt/rh/rh-ruby25/root/usr/lib64' > /etc/
# ldconfig

6. Make a link to ruby2.5


# update-alternatives --display ruby
# update-alternatives --install /usr/bin/ruby ruby /opt/rh/rh-ruby25/root/bin/ruby 25 \
--slave /usr/bin/gem gem /opt/rh/rh-ruby25/root/bin/gem
# update-alternatives --display ruby
ruby -The status is automatic.
Link is now/opt/rh/rh-ruby25/root/bin/It points to ruby.
/opt/rh/rh-ruby25/root/bin/ruby -Priority 25
Slave gem: /opt/rh/rh-ruby25/root/bin/gem
The current "optimal" version is/opt/rh/rh-ruby25/root/bin/It is ruby.

7. Check the ruby version


# ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]

trouble shooting

I get a shared library error


# ruby- v
ruby: error while loading shared libraries: cannot open shared object file: No such file or directory


The library of ruby executable file is not recognized in the shared library.



# echo '/opt/rh/rh-ruby25/root/usr/lib64' > /etc/
# ldconfig


SCL(Software CoLlectioin) A package for CentOS provided by Red Hat. It seems that it can be used without conflicting with yum.


Recommended Posts

Install Ruby 2.5 on CentOS 7 using SCL
Install Ruby 2.7 on CentOS 7 (SCL)
Install Golang on CentOS 8
Install Vertica 10.0 on CentOS 6.10
Install Ruby on Ubuntu 20.04
Install PostgreSQL 12 on Centos8
Install nginx on centOS7
Install Python 3 on CentOS 7
Install kuromoji on CentOS7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Install OpenFOAM v2006 on CentOS
Install Jenkins on Docker's CentOS
Install Apache on CentOS on VirtualBox
Install Ruby 2.7 on RHEL 8 (AppStream)
Install Ruby on Sakura's VPS
Install Ruby on MSYS2 with pacman
Install ngrok on ubuntu16.04 using Vagrant
Install Java Open JDK 8 on CentOS 7
How to install MariaDB 10.4 on CentOS 8
Install apache 2.4.46 from source on CentOS7
Steps to install MySQL 8 on CentOS 8
Steps to install devtoolset-6 on CentOS 7
Install ruby on Ubuntu 20.04 with rbenv
Install Java 9 on windows 10 and CentOS 7
Install samba4 from source code on CentOS8
[Ruby on Rails] Code check using Rubocop-airbnb
Install the webmail client Rainloop on CentOS 8
How to install beta php8.0 on CentOS8
Notes on using FCM with Ruby on Rails
[Ruby on Rails] Image slideshow using Skippr
Install CentOS 7 on Raspberry pi 4 Model B
[CentOS] Install apache-loggen
OpenVPN on CentOS 8
Install NextCloud on CentOS 7 with Alibaba Cloud ECS
Install java and android-sdk on Mac using homebrew
HelloWorld using OpenJDK on CentOS8 after brain death
Try local file search using Fess on CentOS7
Try local file search using Fess on CentOS8
Install Ruby / Rails on Mac M1 Big Sur 2021-01
Install GitLab on CentOS 8 with no internet connection
Install CMS Made Simple v2.2.2 on LAMP on CentOS 7.3
[Ruby on Rails] How to install Bootstrap in Rails
How to install Ruby on an EC2 instance on AWS
Install Corretto 8 on Windows
Maven on CentOS 7 tutorial
Install Ruby 3.0.0 with asdf
Install OpenJDK on macOS
Install Java on Mac
Docker installation on CentOS 6
Use perltidy on CentOS 8
Install pyqt5 on ubuntu
Install BookStack Documentation Wiki on Elastic Compute Service on CentOS 7
Try OpenLiteSpeed on CentOS8
Tomcat v8 on CentOS7
[Ruby] I can't install puma on Mac [Rails, etc.]
[CentOS7] Install aws cli