Open
Description
Ruby 安装方法——RVM
操作系统: CentOS 6.5
说明:在CentOS上,直接用 yum 安装 Ruby的话,安装的版本比较低,所以,就直接用 RVM 进行安装。
步骤1: 安装依赖包
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel -y
# yum install libyaml-devel libffi-devel openssl-devel make -y
# yum install bzip2 autoconf automake libtool bison iconv-devel sqlite-devel -y
步骤2: 安装 RVM
# curl -sSL https://rvm.io/mpapis.asc | gpg --import -
# curl -L get.rvm.io | bash -s stable
# source /etc/profile.d/rvm.sh
# rvm reload
步骤3: 验证环境依赖
# rvm requirements run
Checking requirements for centos.
Requirements installation successful.
步骤4: 安装 Ruby
直接从原始的 Ruby源下载,速度很慢,所以,需要切换成淘宝的镜像源:
# echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > $rvm_path/config/db
执行安装:
# rvm requirements
# rvm install 2.3.0
# rvm use 2.3.0 --default --create
验证是否安装成功, 切换 gem源
# ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
# gem -v
2.5.1
# gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
https://gems.ruby-china.org/ added to sources
https://rubygems.org/ removed from sources