rbenv不使用rbenv和ruby-build在ubuntu上工作吗?

时间:2015-01-25 15:55:44

标签: ruby-on-rails ruby linux ubuntu rbenv

我刚刚在我的ubuntu服务器上安装了rbenv和ruby-build。这是ubntu版本:

Description:  Ubuntu 14.04.1 LTS
Release:  14.04

我安装了rbenv 0.4.0

rbenv有两个问题。首先,当我输入以下命令时,它不会显示最新版本的ruby:

  

rbenv install -v   结果是:

usage: rbenv install VERSION
       rbenv install /path/to/definition

Available versions:
  1.8.6-p383
  1.8.6-p420
  1.8.7-p249
  1.8.7-p302
  1.8.7-p334
  1.8.7-p352
  1.8.7-p357
  1.8.7-p358
  1.9.1-p378
  1.9.2-p180
  1.9.2-p290
  1.9.2-p318
  1.9.2-p320
  1.9.3-dev
  1.9.3-p0
  1.9.3-p125
  1.9.3-p194
  1.9.3-preview1
  1.9.3-rc1
  2.0.0-dev   jruby-1.6.3   jruby-1.6.4   jruby-1.6.5   jruby-1.6.5.1   jruby-1.6.6   jruby-1.6.7   jruby-1.6.7.2   jruby-1.7.0-preview1   maglev-1.0.0   rbx-1.2.4   rbx-2.0.0-dev   ree-1.8.6-2009.06   ree-1.8.7-2009.09   ree-1.8.7-2009.10   ree-1.8.7-2010.01   ree-1.8.7-2010.02   ree-1.8.7-2011.03   ree-1.8.7-2011.12   ree-1.8.7-2012.01   ree-1.8.7-2012.02

如您所知,最新版本为2.2.2!

每次我尝试这个时候都会这样:

  

rbenv install 2.0.0-dev

结果如下:

Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20150125192327.14980
Results logged to /tmp/ruby-build.20150125192327.14980.log

Last 10 log lines:
make[2]: Entering directory `/tmp/ruby-build.20150125192327.14980/yaml-0.1.4/include'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/home/amirabbas/.rbenv/versions/2.0.0-dev/include" || /bin/mkdir -p "/home/amirabbas/.rbenv/versions/2.0.0-dev/include"
 /usr/bin/install -c -m 644  yaml.h '/home/amirabbas/.rbenv/versions/2.0.0-dev/include/.'
/usr/bin/install: cannot remove ‘/home/amirabbas/.rbenv/versions/2.0.0-dev/include/./yaml.h’: Permission denied
make[2]: *** [install-nobase_includeHEADERS] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20150125192327.14980/yaml-0.1.4/include'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20150125192327.14980/yaml-0.1.4/include'
make: *** [install-recursive] Error 1

2 个答案:

答案 0 :(得分:3)

关于Ruby版本,您必须更新ruby-build gem:

cd ~/.rbenv/plugins/ruby-build/
git pull

那么你将拥有2.2版本。

Ruby有一些本机依赖项,​​因此您必须在安装Ruby之前安装它们:

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties

来源:https://gorails.com/setup/ubuntu/14.10

答案 1 :(得分:2)

您需要更新ruby-build才能安装所有新版本。转到:

cd ~/.rbenv/plugins/ruby-build/

然后更新:

git pull

更新后,重新启动终端并运行rbenv install -l列出要安装的所有可用版本(对我来说,最后一个版本是2.3.0-dev)