安装依赖项
bash
sudo yum install -y perl zlib-devel openssl-devel
安装git
bash
sudo yum install -y git
git config --global http.sslVerify false
curl取消ssl认证
bash
echo "insecure" >> ~/.curlrc
安装rbenv
https://github.com/rbenv/rbenv
bash
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
重启bash后继续执行:
bash
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install RUBY_VERSION
rbenv global RUBY_VERSION
验证是否安装成功
bash
ruby -v
gem -v
bundler -v
Ruby安装位置:~/.rbenv/versions/RUBY_VERSION/