2013年5月29日水曜日

passengerのインストール失敗

passengerのインストールの失敗で、スワップ領域が足りなくてエラーになる場合があるそうです。
実際私もハマりました。
この時インストールしたのは、passenger4.0.4でした。
https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/V-t5xsHJ4Sw

こちらのサイトにもありますが、同じエラーがでましたね。

rake abortedのエラーがでて、こんなのがずらずら…。

g++ -o agents/PassengerHelperAgent.o  -Iext -Iext/common  -Iext/libev -Iext/libeio -D_REENTRANT -I/usr/local/include -DHAS_TR1_UNORDERED_MAP -DHAVE_ACCEPT4 -DHAS_ALLOCA_H -DHAS_SFENCE -DHAS_LFENCE -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -ggdb -feliminate-unused-debug-symbols -feliminate-unused-debug-types -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -fcommon -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED -Wno-attributes -c ext/common/agents/HelperAgent/Main.cpp


サーバーを再起動したらあっさり入りました。

gemの取得先設定/変更

Gem2系から、https://rubygems.org/になりましたが、
社内ネットワークなんかで、httpsがブロックされると悲惨…。

こんなふうに追加ができます。

gem sources --add http://rubygems.org/
gem sources --add http://gems.github.com/
 
削除する時はこんな感じ。
gem sources --remove https://rubygems.org/
 
何が設定されているかは、 gem env コマンドで見てみましょう。 
 
gem sources -l を実行するうと設定されたgemの検索対象部だけが見れます 
 

2013年5月27日月曜日

Passenger 4

ようやく出たと、話題になってるPassenger4。
Ruby2.0と一緒に動かそうとするのだけどなかなか動かず。
先ほどちょうど動きました。
Passenger4.0.3が先週金曜日に出たばかりですね。
http://rubygems.org/gems/passenger
ちょうど金曜日に4.0.2と格闘していて全然ダメだったのですが、4.0.3では結構あっさりと動きました。

  • Ruby2.0.0-p195
  • Rails 3.2.6 (そろそろ3.2.13にしないとな)
  • Passenger 4.0.3

インストールした後、apacheで動かしてみたら
"This application is a Rails 3 application, but it was wrongly detected as a Rails 1 or Rails 2 application. "
こんなエラー…。
そいや、以前もこれ見たな…。
腰を据えて調査してみた所、Apacheの設定が変わったようです。
ここを、こんなふうに変えてあげれば良いのです。
RailsBaseURI /report
 ↓
RackBaseURI /report

Rails3から変更が必要らしいのですが、今までRails3でもRailsBaseURIで動いてたんですよね…。
うーん…

2013年5月24日金曜日

Passengerのインストール

私がよくやらかすエラー。
実行する場所が違うのです…。rails アプリの外でやりましょうってことですね。
エラーが出たら、cd.. でだいたい行けます。

$ passenger-install-apache2-module
/home/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'passenger' (>= 0) among 102 total gem(s) (Gem::LoadError)
        from /home/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
        from /home/xxx/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
        from /home/xxx/.rvm/gems/ruby-2.0.0-p0@rails3/bin/passenger-install-apache2-module:18:in `<main>'
        from /home/xxx/.rvm/gems/ruby-2.0.0-p0@rails3/bin/ruby_noexec_wrapper:14:in `eval'
        from /home/xxx/.rvm/gems/ruby-2.0.0-p0@rails3/bin/ruby_noexec_wrapper:14:in `<main>'

Ruby2.0

ruby 2.0.0p195 がようやくインストールできた。
出た翌日にrvmから何度もやったけど、うまく行かなくて、ようやく今日無事完了。
入らなかったから、p0で頑張ってたけどね。

以前入れたものから再実行するとごにょごにょ出てきたので、再度rvm get head, rvm reloadから行なってみた。

そしたら、1度アップデートしたせいもあり、すーっと入った。(エラーがは出なくなった!)
しかし、gemが入らない…(どうしても入らない・・・)

$ rvm install 2.0.0
Searching for binary rubies, this might take some time.
Installing requirements for ubuntu, might require sudo password.
ruby-2.0.0-p195 - #configure
ruby-2.0.0-p195 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16.4M  100 16.4M    0     0  5014k      0  0:00:03  0:00:03 --:--:-- 5268k
ruby-2.0.0-p195 - #validate archive
tar: 記録サイズ = 8 ブロック
tar: 記録サイズ = 8 ブロック
ruby-2.0.0-p195 - #extract
ruby-2.0.0-p195 - #validate binary
ruby-2.0.0-p195 - #setup
Saving wrappers to '/home/xxx/.rvm/wrappers/ruby-2.0.0-p195'........
ruby-2.0.0-p195 - #importing default gemsets, this may take time............................


$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]



昔のバージョン

$ rvm install 2.0.0
Searching for binary rubies, this might take some time.
Installing requirements for ubuntu, might require sudo password.
[sudo] password for xxx:
ヒット http://jp.archive.ubuntu.com lucid Release.gpg
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid/main Translation-ja
無視 http://jp.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid/universe Translation-ja
ヒット http://security.ubuntu.com lucid-security Release.gpg
ヒット http://ppa.launchpad.net lucid Release.gpg
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-ja
ヒット http://archive.canonical.com lucid Release.gpg
ヒット http://jp.archive.ubuntu.com lucid-updates Release.gpg
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main Translation-ja
無視 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/universe Translation-ja
無視 http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-ja
無視 http://ppa.launchpad.net/ubuntu-clamav/ppa/ubuntu/ lucid/main Translation-ja
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse Translation-ja
無視 http://archive.canonical.com/ lucid/partner Translation-ja
ヒット http://jp.archive.ubuntu.com lucid Release
ヒット http://jp.archive.ubuntu.com lucid-updates Release
ヒット http://jp.archive.ubuntu.com lucid/main Packages
無視 http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com lucid/restricted Packages
ヒット http://ppa.launchpad.net lucid Release
ヒット http://archive.canonical.com lucid Release
ヒット http://jp.archive.ubuntu.com lucid/main Sources
ヒット http://jp.archive.ubuntu.com lucid/restricted Sources
ヒット http://jp.archive.ubuntu.com lucid/universe Packages
ヒット http://jp.archive.ubuntu.com lucid/universe Sources
無視 http://security.ubuntu.com/ubuntu/ lucid-security/universe Translation-ja
ヒット http://ppa.launchpad.net lucid/main Packages
ヒット http://jp.archive.ubuntu.com lucid/multiverse Packages
ヒット http://archive.canonical.com lucid/partner Packages
ヒット http://jp.archive.ubuntu.com lucid/multiverse Sources
ヒット http://jp.archive.ubuntu.com lucid-updates/main Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/restricted Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/main Sources
無視 http://security.ubuntu.com/ubuntu/ lucid-security/multiverse Translation-ja
ヒット http://jp.archive.ubuntu.com lucid-updates/restricted Sources
ヒット http://jp.archive.ubuntu.com lucid-updates/universe Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/universe Sources
ヒット http://jp.archive.ubuntu.com lucid-updates/multiverse Packages
ヒット http://security.ubuntu.com lucid-security Release
ヒット http://jp.archive.ubuntu.com lucid-updates/multiverse Sources
ヒット http://security.ubuntu.com lucid-security/main Packages
ヒット http://security.ubuntu.com lucid-security/restricted Packages
ヒット http://security.ubuntu.com lucid-security/main Sources
ヒット http://security.ubuntu.com lucid-security/restricted Sources
ヒット http://security.ubuntu.com lucid-security/universe Packages
ヒット http://security.ubuntu.com lucid-security/universe Sources
ヒット http://security.ubuntu.com lucid-security/multiverse Packages
ヒット http://security.ubuntu.com lucid-security/multiverse Sources
パッケージリストを読み込んでいます...
Installing required packages: bash, curl, patch, bzip2, ca-certificates, gawk, g++, gcc, make, libc6-dev, patch, openssl, ca-certificates, libreadline6, libreadline6-dev, curl, zlib1g, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, libxml2-dev, libxslt1-dev, autoconf, libc6-dev, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev.............................................
ruby-2.0.0-p195 - #configure
ruby-2.0.0-p195 - #download
There is no checksum for 'https://rvm.io/binaries/ubuntu/10.04/x86_64/ruby-2.0.0-p195.tar.bz2?rvm=1.20.9' or 'bin-ruby-2.0.0-p195.tar.bz2', it's not possible to validate it.
This could be because your RVM install's list of versions is out of date. You may want to
update your list of rubies by running 'rvm get stable' and try again.
If that does not resolve the issue and you wish to continue with unverified download
add '--verify-downloads 1' after the command.

Downloading https://rvm.io/binaries/ubuntu/10.04/x86_64/ruby-2.0.0-p195.tar.bz2 failed.

Mounting remote ruby failed, trying to compile.
Installing requirements for ubuntu, might require sudo password.
ヒット http://jp.archive.ubuntu.com lucid Release.gpg
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid/main Translation-ja
無視 http://jp.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid/universe Translation-ja
ヒット http://archive.canonical.com lucid Release.gpg
ヒット http://ppa.launchpad.net lucid Release.gpg
ヒット http://security.ubuntu.com lucid-security Release.gpg
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-ja
ヒット http://jp.archive.ubuntu.com lucid-updates Release.gpg
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/main Translation-ja
無視 http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/universe Translation-ja
無視 http://archive.canonical.com/ lucid/partner Translation-ja
無視 http://ppa.launchpad.net/ubuntu-clamav/ppa/ubuntu/ lucid/main Translation-ja
無視 http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-ja
ヒット http://jp.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse Translation-ja
ヒット http://jp.archive.ubuntu.com lucid Release
ヒット http://jp.archive.ubuntu.com lucid-updates Release
ヒット http://jp.archive.ubuntu.com lucid/main Packages
ヒット http://jp.archive.ubuntu.com lucid/restricted Packages
ヒット http://archive.canonical.com lucid Release
ヒット http://ppa.launchpad.net lucid Release
無視 http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-ja
ヒット http://jp.archive.ubuntu.com lucid/main Sources
ヒット http://jp.archive.ubuntu.com lucid/restricted Sources
ヒット http://jp.archive.ubuntu.com lucid/universe Packages
ヒット http://jp.archive.ubuntu.com lucid/universe Sources
ヒット http://archive.canonical.com lucid/partner Packages
ヒット http://jp.archive.ubuntu.com lucid/multiverse Packages
ヒット http://ppa.launchpad.net lucid/main Packages
無視 http://security.ubuntu.com/ubuntu/ lucid-security/universe Translation-ja
ヒット http://jp.archive.ubuntu.com lucid/multiverse Sources
ヒット http://jp.archive.ubuntu.com lucid-updates/main Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/restricted Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/main Sources
ヒット http://jp.archive.ubuntu.com lucid-updates/restricted Sources
無視 http://security.ubuntu.com/ubuntu/ lucid-security/multiverse Translation-ja
ヒット http://jp.archive.ubuntu.com lucid-updates/universe Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/universe Sources
ヒット http://jp.archive.ubuntu.com lucid-updates/multiverse Packages
ヒット http://jp.archive.ubuntu.com lucid-updates/multiverse Sources
ヒット http://security.ubuntu.com lucid-security Release
ヒット http://security.ubuntu.com lucid-security/main Packages
ヒット http://security.ubuntu.com lucid-security/restricted Packages
ヒット http://security.ubuntu.com lucid-security/main Sources
ヒット http://security.ubuntu.com lucid-security/restricted Sources
ヒット http://security.ubuntu.com lucid-security/universe Packages
ヒット http://security.ubuntu.com lucid-security/universe Sources
ヒット http://security.ubuntu.com lucid-security/multiverse Packages
ヒット http://security.ubuntu.com lucid-security/multiverse Sources
パッケージリストを読み込んでいます...
Installing required packages: bash, curl, patch, bzip2, ca-certificates, gawk, g++, gcc, make, libc6-dev, patch, openssl, ca-certificates, libreadline6, libreadline6-dev, curl, zlib1g, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, libxml2-dev, libxslt1-dev, autoconf, libc6-dev, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev.............................................
Installing Ruby from source to: /home/xxx/.rvm/rubies/ruby-2.0.0-p195, this may take a while depending on your cpu(s)...
ruby-2.0.0-p195 - #downloading ruby-2.0.0-p195, this may take a while depending on your connection...
ruby-2.0.0-p195 - #extracting ruby-2.0.0-p195 to /home/xxx/.rvm/src/ruby-2.0.0-p195
ruby-2.0.0-p195 - #extracted to /home/xxx/.rvm/src/ruby-2.0.0-p195
ruby-2.0.0-p195 - #configuring.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-2.0.0-p195 - #compiling................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
ruby-2.0.0-p195 - #installing ...............................................................................................................................................................................................................................................................................................
Retrieving rubygems-2.0.3
######################################################################## 100.0%
Extracting rubygems-2.0.3 ...
Removing old Rubygems files...
Installing rubygems-2.0.3 for ruby-2.0.0-p195...........................................................................................................................................................................................................................................................................................................................................................................................................
Installation of rubygems completed successfully.
Saving wrappers to '/home/xxx/.rvm/wrappers/ruby-2.0.0-p195'........

ruby-2.0.0-p195 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-2.0.0-p195 - #importing default gemsets, this may take time............................
Install of ruby-2.0.0-p195 - #complete

$ rvm use 2.0.0
Using /home/xxx/.rvm/gems/ruby-2.0.0-p195
$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]