Ruby 2.2.4发布 ,这是Ruby的2.2系列的升级。 Ruby是一个动态的、面向对象的编程语言。我们正在使用RVM,它代表的Ruby版本管理,这使得更容易在Linux平台上安装Ruby。 RVM也是管理的Ruby版本多无冲突的帮助,我们可以使用一个命令切换系统,以使用Ruby 的任何版本。 本文将帮助你如何在CentOS,Red Hat系统使用RVM安装Ruby 2.2.4。
第1步:安装所需的程序包
首先,我们需要使用下面的命令我们的系统上安装Ruby安装所有需要的软件包。
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel sqlite-devel
第2步:安装RVM
使用以下命令在系统上安装RVM的最新稳定版本。这个命令会自动下载所有必需的文件并安装在系统上。
# curl -sSL https://rvm.io/mpapis.asc | gpg --import -
# curl -L get.rvm.io | bash -s stable
现在,使用下面的命令来设置RVM环境。
# source /etc/profile.d/rvm.sh
# rvm reload
第3步:验证依赖
现在,使用下面要验证所有的依赖性都安装正确。
# rvm requirements run
Checking requirements for centos.
Requirements installation successful.
第4步:安装Ruby 2.2
完成RVM环境的设置之后,可以通过安装下面的命令Ruby语言。
# rvm install 2.2.4
[样本输出]
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-2.2.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.2.4, this may take a while depending on your cpu(s)...
ruby-2.2.4 - #downloading ruby-2.2.4, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12.7M 100 12.7M 0 0 33.5M 0 --:--:-- --:--:-- --:--:-- 33.6M
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.4 - #extracting ruby-2.2.4 to /usr/local/rvm/src/ruby-2.2.4....
ruby-2.2.4 - #configuring...................................................
ruby-2.2.4 - #post-configuration..
ruby-2.2.4 - #compiling.....................................................
ruby-2.2.4 - #installing............................
ruby-2.2.4 - #making binaries executable..
ruby-2.2.4 - #downloading rubygems-2.4.8
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 437k 100 437k 0 0 2367k 0 --:--:-- --:--:-- --:--:-- 2376k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.4 - #extracting rubygems-2.4.8....
ruby-2.2.4 - #removing old rubygems.........
ruby-2.2.4 - #installing rubygems-2.4.8......................
ruby-2.2.4 - #gemset created /usr/local/rvm/gems/ruby-2.2.4@global
ruby-2.2.4 - #importing gemset /usr/local/rvm/gemsets/global.gems...............................................
ruby-2.2.4 - #generating global wrappers........
ruby-2.2.4 - #gemset created /usr/local/rvm/gems/ruby-2.2.4
ruby-2.2.4 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.4 - #generating default wrappers........
ruby-2.2.4 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.2.4 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
第5步:设置默认的Ruby版本
使用RVM命令设置默认Ruby 版本由应用程序使用。
# rvm use 2.2.4 --default
Using /usr/local/rvm/gems/ruby-2.2.4
第6步:检查当前Ruby版本。
使用以下命令可以查看当前的Ruby 版本使用。
# ruby --version
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
恭喜,你已经成功地在系统上安装Ruby。请阅读我们的下一篇文章,
Ruby 与Apache集成与简单的步骤,Web服务器。
参考文献:
http://rvm.io/rubies/installing