ruby版本是最新的,但在安装机架和乘客时仍然出现错误,如何修复



在centos-7 上

sudo gem install rack passenger
[root@puppetmaster bin]# sudo gem install rack passenger
ERROR:  Error installing rack:
rack requires Ruby version >= 2.3.0.
ERROR:  Error installing passenger:
rake requires Ruby version >= 2.2.
[root@puppetmaster bin]# yum update ruby
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
* base: mirror.atlanticmetro.net
* extras: mirror.atlanticmetro.net
* updates: mirror.atlanticmetro.net
No Packages marked for Update
[root@puppetmaster bin]# yum upgrade ruby
Loaded plugins: fastestmirror
Setting up Upgrade Process
Loading mirror speeds from cached hostfile
* base: mirror.atlanticmetro.net
* extras: mirror.atlanticmetro.net
* updates: mirror.atlanticmetro.net
No Packages marked for Update

[root@puppetmaster bin]# ruby --version
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
[root@puppetmaster bin]# yum install ruby
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.cc.columbia.edu
* extras: mirror.cc.columbia.edu
* updates: mirror.cc.columbia.edu
Package ruby-1.8.7.374-5.el6.x86_64 already installed and latest version
Nothing to do

我会使用rbenv来管理ruby

rbenv和Ruby 的首次安装依赖关系

$ sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel

安装rbenv 后

cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

选择更新的ruby版本以使用

rbenv install -l

安装ruby版本

rbenv install -v $RUBY_VERSION
rbenv rehash

设置为全局使用

rbenv global $RUBY_VERSION

完整说明参考在CentOS 7 上安装带有Rbenv的Ruby on Rails

最新更新