捆绑安装 - 部署无法使用“gcc:权限被拒绝”

时间:2013-08-09 13:55:31

标签: ruby-on-rails ruby capistrano

我一直在设置服务器上运行Rails应用程序,最近开始配置Capistrano进行部署。部署本身似乎相当一致,但在尝试运行bundle install --deployment时失败。摘自日志:

 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
 /usr/local/bin/ruby extconf.rb
 creating Makefile
 make
 compiling crypt_blowfish.c
 make: execvp: gcc: Permission denied
 make: *** [crypt_blowfish.o] Error 127
 Gem files will remain installed in /home/.../public_html/v4/shared/bundle/ruby/2.0.0/gems/bcrypt-ruby-3.0.1 for inspection.
 Results logged to /home/.../public_html/v4/shared/bundle/ruby/2.0.0/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
 An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot
 continue.
 Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.

对于它的价值,gem install bcrypt-ruby -v '3.0.1'作为非root用户失败(即使使用sudo权限)。它以root用户身份运行。

gem_make.out日志说:

/usr/local/bin/ruby extconf.rb
creating Makefile

make
compiling crypt_blowfish.c
make: execvp: gcc: Permission denied
make: *** [crypt_blowfish.o] Error 127

许可被拒绝。这很有趣,因为我认为这是使用bundle install --deployment的重点。我到处寻找,没有发现任何有用的东西。

我有一种感觉,这可能与ruby安装的事实有关,可能是root用户。那是 - 当我到达服务器时它已经安装好了。我尝试使用RVM重新安装ruby(作为非root用户,但无论哪种方式我得到相同的结果)并得到:

Searching for binary rubies, this might take some time.
Installing requirements for centos, might require sudo password.
Installing required packages: gcc-c++, libyaml-devel, libffi-devel...................................................................................
Error running 'requirements_centos_libs_install gcc-c++ libyaml-devel libffi-devel',
please read /home/.../.rvm/log/ruby-2.0.0-p247/1376056268_package_install_gcc-c++_libyaml-devel_libffi-devel.log

那里的日志说......

Transaction Check Error:
  package libgcc-4.4.7-3.el6.x86_64 is already installed
  package glibc-2.12-1.107.el6_4.2.x86_64 is already installed
  package gmp-4.3.1-7.el6_2.2.x86_64 is already installed
  package mpfr-2.4.1-6.el6.x86_64 is already installed
  package nss-softokn-freebl-3.14.3-3.el6_4.x86_64 is already installed
  package libstdc++-4.4.7-3.el6.x86_64 is already installed
  package libffi-3.0.5-3.2.el6.x86_64 is already installed
  file /sbin/ldconfig from install of glibc-2.12-1.107.el6_4.2.x86_64 conflicts with file from package glibc-2.12-1.107.el6_4.2.i686
  file /sbin/sln from install of glibc-2.12-1.107.el6_4.2.x86_64 conflicts with file from package glibc-2.12-1.107.el6_4.2.i686
  file /usr/sbin/iconvconfig from install of glibc-2.12-1.107.el6_4.2.x86_64 conflicts with file from package glibc-2.12-1.107.el6_4.2.i686

长话短说我不知道​​该做什么。

运行CentOS 6.4 / cPanel。

提前感谢您的帮助!

3 个答案:

答案 0 :(得分:0)

您是否尝试完全删除ruby并使用rvm重新安装它,而不仅仅是重新安装它?

答案 1 :(得分:0)

想出来。

事实证明,这里存在一些问题:

  1. 您无法在cPanel服务器上安装RVM
  2. 如果您不是root用户(在cPanel服务器上),也无法在没有sudo命令的情况下安装gem。
  3. 我最终在这里安装了ruby作为有问题的用户(在this guide之后)并且或多或少得到了我想要的东西。

    我需要做sudo bundle install --deployment才能让它真正发挥作用,但除此之外,这对我有用。

    感谢大家的帮助!

答案 2 :(得分:0)

您可以尝试通过以下方式修复rvm权限:

rvmsudo rvm cleanup all

从理论上讲,使用sudo时永远不需要rvm