How to install Ruby on CentOS/Rhel7/6? Ruby is a dynamic, object-oriented programming language that is simple and effective. RVM (Ruby Version Manager) is a tool for installing and managing multiple Ruby versions on a single operating system.
This article will introduce installing RVM on the system. Then use RVM to install the latest Ruby on CentOS and RedHat systems.
Step 1: Installation Requirements
First, you need to install all the required ruby installation on our system using the following commands Bag.
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel \ libyaml-devel libffi-devel openssl-devel make \ bzip2 autoconf automake libtool bison iconv-devel sqlite-devel
Step 2: Install RVM
Now, use the following command to install the latest stable version of RVM on your system. This command will automatically download all required files and install them on your system.
# curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - # curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - # curl -L get.rvm.io | bash -s stabl
Also, run the following command to load the RVM environment.
# source /etc/profile.d/rvm.sh # rvm reload
Step 3: Verify dependencies
Now use the following command to verify that all dependencies have been installed correctly. This will install other missing dependencies on your system.
# rvm requirements run Checking requirements for centos. Requirements installation successful
Step 4: Install Ruby on CentOS
Now, your system is ready for Ruby installation. You can find the Ruby version available for installation using the command below.
# rvm list known
Step 5: Set Default Ruby Version
First, check the Ruby version currently installed on your system. This way we can find out which version the system is currently using, and which version is set as default.
# rvm list ruby-2.4.4 [ x86_64 ] * ruby-2.5.1 [ x86_64 ] => ruby-2.6.0 [ x86_64 ] # => - current # =* - current && default # * - default
After that, use the rvm command to set the default Ruby version to be used by the application.
# rvm use 2.6 --default Using /usr/local/rvm/gems/ruby-2.6.0
Step 6: Verify current Ruby version
Using the following command, you can check the Ruby version currently in use.
# ruby --version ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
You’re done, Ruby has been successfully installed on your system.
This article has ended here. For more other exciting content, you can pay attention to theLinux Video Tutorialcolumn on the PHP Chinese website!
The above is the detailed content of How to install Ruby on CentOS and RHEL. For more information, please follow other related articles on the PHP Chinese website!