如何在ubuntu 11.10上安装最新版本的rails?

时间:2012-01-31 18:18:20

标签: ruby-on-rails ubuntu gem rbenv

我想在ubuntu 11.10上安装rails 3.2.1。 我已经安装了rbenv,ruby-build。

当我跑步时

gem install rails
它告诉我

Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...

然后在rbenv rehash之后,如果我运行“rails”,它就找不到二进制文件了。所以我猜没有安装rails。我该怎么办?

编辑:

~ » gem environment                                                                                                                                                                                                                
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/jafar/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /home/jafar/.rbenv/versions/1.9.3-p0/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jafar/.rbenv/versions/1.9.3-p0/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/jafar/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1
     - /home/jafar/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

编辑2:

gem list告诉我rails的安装。当我搜索rails二进制文件时,我发现了这个:

~ » find . -name rails
./.oh-my-zsh/plugins/rails
./Downloads/robbyrussell-oh-my-zsh-3629270/plugins/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/guides/code/getting_started/script/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/bin/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/generators/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/generators/rails/app/templates/script/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/generators/rails/plugin_new/templates/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.4/test/fixtures/engine_project/script/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.4/test/fixtures/engine_project/test/dummy/script/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.4/test/fixtures/scss_project/script/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.4/test/fixtures/sass_project/script/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.4/lib/sass/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-rails-3.2.4/lib/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionmailer-3.2.1/lib/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jquery-rails-2.0.0/lib/jquery/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sass-3.1.12/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/coffee/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/rails
./.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bin/rails

rails二进制文件应该在〜/ .rbenv / shims中,但事实并非如此。 〜/ .rbenv / shims在我的PATH中

1 个答案:

答案 0 :(得分:1)

您需要将bin /home/jafar/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1子目录添加到PATH,例如编辑您的~/.bashrc文件并在最后添加此行: export PATH=/home/jafar/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bin:$PATH

然后看看命令rails --version将输出什么。