How to install Ruby on CentOS and RHEL

不言
Release: 2019-03-30 14:25:29
Original
2971 people have browsed it

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.

How to install Ruby on CentOS and RHEL

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
Copy after login

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
Copy after login

Also, run the following command to load the RVM environment.

# source /etc/profile.d/rvm.sh # rvm reload
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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]
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!