tohokuaikiのチラシの裏

技術的ネタとか。

とりあえずスタートしてみる

環境

# more /etc/issue
Debian GNU/Linux 6.0 \n \l
# ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i486-linux]
# gem -v
1.8.9
# rails -v
Rails 3.0.10

rubyは最初1.8が入ってたので

#apt-get install -y ruby1.9.2
#apt-get install ruby1.9.1-dev

gemも最初1.3.7が入ってたので最新版をダウンロード。
これだけは手動で入れた。

#wget http://rubyforge.org/frs/download.php/75296/rubygems-1.8.9.tgz
#tar xvzfmp rubygems-1.8.9.tgz
#cd rubygems-1.8.9
#ruby setup.rb

で、update-alternatives で/usr/bin/rubyと/usr/bin/gemを管理

#update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.8 0
#update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 1
#update-alternatives --config ruby
#update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.9.1
#update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.9.1 1
#update-alternatives --config gem

で、railsインストール

# gem install rails

ここまでは問題なし。

Rails

http://guides.rubyonrails.org/getting_started.html
に沿ってやる。


$ bundle install

Installing sqlite3 (1.3.4) /usr/local/lib/site_ruby/1.9.1/rubygems/installer.rb:448:in `verify_gem_home': You don't have write permissions into the /usr/lib/ruby/gems/1.9.1 directory. (Gem::FilePermissionError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/installer.rb:147:in `install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/source.rb:101:in `block in install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/source.rb:91:in `install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:58:in `block (2 levels) in run'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:57:in `block in run'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/bin/bundle:13:in `'
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19:in `

'

でエラー。

gemでsqlite3を直接入れてみる

その前に、

# apt-get install sqlite3
# apt-get install libsqlite3-dev
# apt-get install libsqlite3-ruby1.9

これやらないと

# gem install sqlite3
Fetching: sqlite3-1.3.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
:29:in `require': no such file to load -- mkmf (LoadError)
from :29:in `require'
from extconf.rb:3:in `

'

とかなる。

で、

# gem install sqlite3

$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.10)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.10)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.10)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.10)
Using arel (2.0.10)
Using activerecord (3.0.10)
Using activeresource (3.0.10)
Using bundler (1.0.18)
Using rdoc (3.9.3)
Using thor (0.14.6)
Using railties (3.0.10)
Using rails (3.0.10)
Using sqlite3 (1.3.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

となる。