环境:
CentOS release 6.6 (Final) 2.6.32-504.el6.x86_64
1、安装rvm
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \curl -sSL https://get.rvm.io | bash -s stable
如果不行去掉https再试下
curl -L get.rvm.io | bash -s stable
如果都有报错执行
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
然后继续执行
curl -L get.rvm.io | bash -s stable
2、使配置文件生效
source /etc/profile.d/rvm.sh
3、下载RVM依赖
rvm requirements
4、安装ruby依赖包
yum install gcc-c++ patch readline readline-devel zlib zlib-devellibyaml-devel libffi-devel openssl-devel makebzip2 autoconf automake libtool bison iconv-devel sqlite-devel
5、更换rvm源为淘宝的
sed -i -E ‘s!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!‘ $rvm_path/config/db
6、安装ruby 2.1.1版本
rvm install 2.1.1 rvm use 2.1.1 --default
7、测试
ruby --version
时间: 2024-10-20 21:33:09