參考官方文檔: 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
操作請參考線安裝