CentOS安装Ruby环境

安装依赖项

sudo yum install -y perl zlib-devel openssl-devel

安装git

sudo yum install -y git
git config --global http.sslVerify false

curl取消ssl认证

echo "insecure" >> ~/.curlrc

安装rbenv

https://github.com/rbenv/rbenv

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc

重启bash后继续执行:

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install RUBY_VERSION
rbenv global RUBY_VERSION

验证是否安装成功

ruby -v
gem -v
bundler -v

Ruby安装位置:~/.rbenv/versions/RUBY_VERSION/

你可能感兴趣的:(centos,ruby,linux)