RVM
RVM 是一个命令行工具,可以提供一个便捷的多版本 Ruby 环境的管理和切换。
如果你打算学习 Ruby / Rails, RVM 是必不可少的工具之一。
RVM 安装
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
source ~/.bashrc
source ~/.bash_profile
修改 RVM 的 Ruby 安装源到 Ruby China 的 Ruby 镜像服务器,这样能提高安装速度
echo "ruby_url=https://cache.ruby-china.com/pub/ruby" > /usr/local/rvm/user/db
安装一个 ruby 版本
rvm install 2.7.4
No binary rubies available for: centos/7/x86_64/ruby-2.7.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.7.4, this may take a while depending on your cpu(s)...
ruby-2.7.4 - #downloading ruby-2.7.4, this may take a while depending on your connection...
** Resuming transfer from byte position 4096
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.1M 100 14.1M 0 0 6654k 0 0:00:02 0:00:02 --:--:-- 6654k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.7.4 - #extracting ruby-2.7.4 to /usr/local/rvm/src/ruby-2.7.4.....
ruby-2.7.4 - #configuring........................................................................
ruby-2.7.4 - #post-configuration..
ruby-2.7.4 - #compiling...............................................................................................
ruby-2.7.4 - #installing................................
ruby-2.7.4 - #making binaries executable...
Installed rubygems 3.1.6 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.4 - #gemset created /usr/local/rvm/gems/ruby-2.7.4@global
ruby-2.7.4 - #importing gemset /usr/local/rvm/gemsets/global.gems................................................................
ruby-2.7.4 - #generating global wrappers........
ruby-2.7.4 - #gemset created /usr/local/rvm/gems/ruby-2.7.4
ruby-2.7.4 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.4 - #generating default wrappers........
ruby-2.7.4 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.4 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
评论区