How to Install Ruby on CentOS/RHEL 7/6
2019-12-11 17:02 狼人:-) 阅读(458) 评论(0) 编辑 收藏 举报How to Install Ruby on CentOS/RHEL 7/6 . Ruby is a dynamic, object-oriented programming language focused on simplicity and productivity. RVM (Ruby Version Manager) is a tool for installing and managing multiple Ruby versions on single operating systems. This tutorial will help you to install RVM on your system. After that install the latest Ruby on CentOS and RedHat systems using RVM.
Step 1 – Installing Requirements
First of all, you need to install all required packages for ruby installation on our system using the following command.
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, install the latest stable version of RVM on your system using the following command. This command will automatically download all required files and install 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 stable
Also, run below 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 all dependencies are properly installed. This will install any 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 the Ruby installation. You can find the available Ruby version for installation using below command.
rvm list known
Then install the required Ruby version on your system. Here, I am installing Ruby 2.6 on my CentOS system. You can simply replace the version to below command of your choice and install.
rvm install 2.6
Step 5 – Setup Default Ruby Version
First of all, check the currently installed ruby versions on your system. So that we can find which version is using currently by the system and which is set to 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 rvm command to set up the default ruby version to be used by applications.
rvm use 2.6 --default Using /usr/local/rvm/gems/ruby-2.6.0
Step 6 – Verify Active Ruby Version
Using following command you can check the current ruby version is used.
ruby --version ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
Congratulation’s, Finally you have successfully installed Ruby on your system. Read our next articles to deploy Ruby with Apache or Ruby with Nginx web server with simple steps.
References:
1. http://rvm.io/rubies/installing
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南