参考官方文档: https://rvm.io/rvm/offlinec++
参考博客:https://blog.csdn.net/topswim/article/details/79260369git
[root@xiaoyuer ~]# cat /etc/redhat-release CentOS release 6.8 (Final) [root@xiaoyuer ~]# uname -r 2.6.32-642.6.2.el6.x86_64 [root@xiaoyuer ~]# getenforce Disabled [root@xiaoyuer ~]# hostname -I 172.21.0.10 [root@xiaoyuer ~]# hostname xiaoyuer [root@xiaoyuer ~]# /etc/init.d/iptables status iptables: Firewall is not running. [root@xiaoyuer ~]#
curl -sSL https://github.com/rvm/rvm/tarball/stable -o rvm-stable.tar.gzgithub
mkdir rvm && cd rvmsql
tar --strip-components=1 -xzf ../rvm-stable.tar.gzcentos
./install --auto-dotfilesruby
source ~/.rvm/scripts/rvmcurl
选择版本并下载Ruby,rubygems,yaml安装包。(这里以Ruby 2.2.0和rubygems 2.4.6为例)ui
curl -sSL https://ftp.ruby-lang.org/pub/ruby/ruby-2.2.0.tar.bz2 -o ruby-2.2.0.tar.bz2url
curl -sSL http://production.cf.rubygems.org/rubygems/rubygems-2.4.6.tgz -o rubygems-2.4.6.tgzspa
curl -sSL http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz -o yaml-0.1.6.tar.gz
echo rvm_archives_path=/path/to/tarballs/ >> ~/.rvmrc
取消自动依赖并手动安装对应依赖包。(此处离线安装时,须要下载对应安装包,上传并手动安装)。
rvm autolibs read-fail
source /etc/profile.d/rvm.sh
rvm requirements
这里选择yum安装(缺什么安装什么)
yum install -y bison gcc-c++ libffi-devel libtool patch readline-devel sqlite-devel zlib-devel libyaml-devel openssl-devel
echo "" > rvm/gemsets/default.gems
echo "" > ~/.rvm/gemsets/global.gems
rvm install 2.2.0 --rubygems 2.4.6
rvm use 2.2.0 --default
操作请参考线安装