如何使用rvm在dreamhost共享服务器上安装ruby?

时间:2013-04-03 21:27:34

标签: ruby-on-rails rvm dreamhost

我一直在这里关注指南: http://spontaneousderivation.com/2012/09/30/rails-3-2-on-a-shared-dreamhost-server/ 让dream 3.2和ruby 1.9.3在dreamhost共享服务器上运行,但是我遇到了一个他们没有提到的错误。在安装rvm时,它无法安装没有root访问权限的要求,这是我没有的。它列出了以下要求:

libreadline6-dev, libyaml-dev, automake, libtool, libffi-dev

如果我通过设置以下

来设置autolibs来忽略它
rvm autolibs 1

并运行:

rvm install ruby-1.9.3

然后它到达编译步骤并给出这个错误:

Error running 'make -j8',
please read /home/USER/.rvm/log/ruby-1.9.3-p392/make.log
There has been an error while running make. Halting the installation.

有谁知道我可以绕过这种方式吗?我已经尝试了几天了。

这是make.log的内容:

    CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration  -fPIC 
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
DLDFLAGS = -Wl,-soname,libruby.so.1.9  
SOLIBS = -lpthread -lrt -ldl -lcrypt -lm  
compiling main.c
compiling dmydln.c
compiling dmyencoding.c
compiling version.c
compiling array.c
compiling miniprelude.c
compiling bignum.c
compiling class.c
compiling compar.c
compiling complex.c
compiling dir.c
compiling dln_find.c
compiling enum.c
compiling enumerator.c
make: *** [enumerator.o] Killed
make: *** Waiting for unfinished jobs....

2 个答案:

答案 0 :(得分:3)

您应该使用二进制文件安装ruby(没有编译错误)。像这样:

$ rvm list remote

# Rubies available for 'debian/6/x86_64':
  ruby-1.9.3-p194
  ruby-1.9.3-p286
  ruby-1.9.3-p327
  ruby-1.9.3-p362
  ruby-1.9.3-p374
* ruby-1.9.3-p392
  ruby-1.9.3-p429
  ruby-1.9.3-p448
  ruby-2.0.0-p0
  ruby-2.0.0-p195
* ruby-2.0.0-p247

# * - installed already

然后你就像这样安装二进制文件:

$ rvm mount -r https://rvm.io/binaries/{YOUR_SERVER_ENV}/{RUBY_VERSION}.tar.bz2 --verify-downloads 1

$ rvm mount -r https://rvm.io/binaries/debian/6.0.4/x86_64/ruby-1.9.3-p448.tar.bz2 --verify-downloads 1

当然,除了ruby-1.8.7之外,你不能使用带有RVM的Passenger和其他任何东西。请参阅此文章以设置FastCGI:http://wiki.dreamhost.com/Rails_3#Using_FastCGI

答案 1 :(得分:0)

不确定这篇wiki文章是否存在,但Dreamhost现在有one。直接从它&假设您有SSH访问权限,

检查以确保正确安装rvm:

rvm --version
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

获取可用版本列表:

rvm list known

安装您想要的版本

rvm install 2.2.2

告诉系统默认的ruby版本

rvm use 2.2.2 --default

检查以确保安装了正确的ruby版本

ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

如果这不起作用 - 我会按照教程中的步骤再次安装rvm

  1. 安装RVM的公钥

    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    
  2. 安装最新的稳定版RVM,这将

    curl -sSL https://get.rvm.io | bash -s stable
    

    在名为/.rvm的用户下创建一个新文件夹 将此行添加到.bash_profile

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
    

    将此行添加到.bashrc文件中:

    export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    
  3. 运行此选项以取消设置GEM_HOME

    unset GEM_HOME
    
  4. 运行此命令以获取新的RVM安装源:

    source ~/.rvm/scripts/rvm
    
  5. 将此添加到.bashrc文件

    source .bash_profile
    
  6. 运行此命令以更新.bash_profile:

    . ~/.bash_profile
    
  7. 现在检查RVM是否已安装并正常运行:

    rvm --version
    rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]