CentOS上のRuby on Railsにトラブルが起こっている。
一通りインストールを終えた後、テスト用のプロジェクトを作ってみようとするとエラーが発生。
========================================
[rails@centos ~]$ rails new testrails
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/assets/images/.keep
create app/mailers/.keep
create app/models/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/robots.txt
create test/fixtures
create test/fixtures/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
/usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for rb_integer_pack()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile
/usr/local/lib/ruby/2.1.0/mkmf.rb:2189:in `initialize': Permission denied @ rb_sysopen - Makefile (Errno::EACCES)
from /usr/local/lib/ruby/2.1.0/mkmf.rb:2189:in `open'
from /usr/local/lib/ruby/2.1.0/mkmf.rb:2189:in `create_makefile'
from extconf.rb:55:in `
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/sqlite3-1.3.9/gem_make.out
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
from /usr/local/lib/ruby/2.1.0/tempfile.rb:324:in `open'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `each'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `find'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems.rb:185:in `try_activate'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/vendor/net/http/persistent.rb:12:in `
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/vendored_persistent.rb:3:in `
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/fetcher.rb:1:in `
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/cli/install.rb:68:in `run'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/cli.rb:146:in `install'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/vendor/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/vendor/thor.rb:363:in `dispatch'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/vendor/thor/base.rb:440:in `start'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/cli.rb:9:in `start'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/bin/bundle:20:in `block in
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.0.rc2/bin/bundle:20:in `
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
========================================
なんとなく吐き出されたメッセージを見ていると、bundle install以降にトラブルが発生していて、それも/usr/local/lib/ruby 以下のアクセス権に問題が発生している模様。
ディレクトリ、ファイルはインストール時に所有者がrootになっているのは仕方ないとして、利用者グループを変更することで、この問題を解決したい。
もともとrailsでいろいろ実験するアカウントは、railsというグループに所属させていた。だからこのグループが/usr/local/lib/ruby/以下のすべてのファイル、ディレクトリに対し「読み書き」ができるようにしてあげれば良いのではないかと。
所有者がrootなので、suコマンドなどで一時的にrootになり、/usr/local/lib/の位置でrubyディレクトリに対し次のコマンドを叩くと良い。
chgrp -R rails ruby
(意味は、rubyのディレクトリとその中身のグループを全部railsに変更する)
これで、rubyディレクトリの中身すべてのグループがrailsになる。
それからrubyディレクトリに対し、railsグループが読み書き実行できるようにアクセス権の変更を行う。
chmod -R g+rwx ruby
あらためて rails new testrails を叩くと、問題なく終了するはず。
はぁ、それにしてもUnix系のOSは、アクセス権の設定でつまづくことが多いような気がする。
Windowsのお気楽なアクセス権設定とは雲泥の差だわ。
0 件のコメント:
コメントを投稿