ページ

2011年6月19日日曜日

Ruby on Rails (Rails3)をインストール (ubuntu11.04JP)

● まず
参考にしたサイトは: ubuntuのCommunity DocumentationsrvmのInstall の2つ
この投稿の下の方にあれこれ試行錯誤した経過を残しておきます。今回は Leex40さんに
いろいろ教えて頂きました。なかでも参考にするドキュメント類で、例えば上記の2つ。
まずは「おおもと」をあたる。これが近道... というより定石なんでしょうね。他RailsForum


● さて
$ sudo apt-get install build-essential


 Sqlite3をインストール
$ sudo apt-get install sqlite3 libsqlite3-dev
試しに:
$ sqlite3
SQLite3 version 3.7.4
sqlite >
動きました。 参考にしたウェブサイト: UbuntuにSQLite3をインストールして使ってみた
sqlite > .quit で抜ける


 Ruby1.9.2をインストール (1.9.1からGemが同梱されています)
Rubyサイトからダウンロード
$ tar xzvf ruby-1.9.2-p180.tar.gz
$ cd ruby-1.9.2-p180
$ ./configure
$ make
$ sudo make install


● rvmをインストール (Ruby Version Manager)
$ sudo apt-get install git-core (必要です)
$ sudo apt-get install curl (必要です)

$ cd
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
スペースも含めこの通りに打ち込むとOk。 .bashrc に以下が追記される
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*


$ source .bashrc
$ rvm reload
$ rvm -v (確認) -> rvm 1.6.20 by Wayne E. Seguin
$ rvm notes -> 注意書きと、環境に応じて更にインストールの必要なものが表示される

# For Ruby (MRI & ree)  you should install the following OS dependencies:
  ruby: /usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
また、.bashrcの '&& return' とある行を書き換えるよう書かれている。書き換えで行の先頭が'if'であれば対応する'fi'を入れる... なども記載あり

 $ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

$ rvm install 1.9.2 -> Ruby1.9.2と関連するものをユーザー・ディレクトリにインストールする
$ rvm use 1.9.2 -> Ruby1.9.2を使うように設定される。但しシェル実行の度に打つ必要あり
$ rvm use 1.9.2 --default -> と指定すると常に1.9.2を参照するようになる
Using /home/hito/.rvm/gems/ruby-1.9.2-p180
$ rvm use system -> でrvmに依存せずにインストールされたRubyを参照するようになる

● Railsをインストール
$ gem install rails --no-ri --no-rdoc

● 実行してみる
$ rails new /home/hito/sample -> Ok
$ cd /home/hito/sample
$ rails server -> う゛ エラー
Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

$ bundle install -> なんとSQLite3が入ってなかったみたい... 先のlibは必要です
Installing sqlite3 (1.3.3) with native extensions 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

$ rails server
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-06-19 15:54:02] INFO  WEBrick 1.3.1
[2011-06-19 15:54:02] INFO  ruby 1.9.2 (2011-02-18) [i686-linux]
[2011-06-19 15:54:02] INFO  WEBrick::HTTPServer#start: pid=27849 port=3000


ブラウザで'127.0.0.1:3000'を打つと...  きました 'Welcome aboard'


● Railsの本




 - - - - - - これ以下はちょっと前に苦戦した跡です - - - - - - -
● まず
$ sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev


● Sqlite3をインストール
$ sudo apt-get install sqlite3 libsqlite3-ruby
試しに:
$ sqlite3
SQLite3 version 3.6.22
sqlite >
動きました。 参考にしたウェブサイト: UbuntuにSQLite3をインストールして使ってみた
sqlite > .quit で抜ける


● Ruby1.8.7をインストール
Rubyサイトからダウンロード
$ tar xzvf ruby-1.8.7-p334.tar.gz
$ cd ruby-1.8.7-p334
$ ./configure
$ make
$ make install


● Gemをインストール
RubyForgeからrubygems-1.6.2をダウンロード
$ tar xzvf rubygems-1.6.2.tgz
$ cd rubygems-1.6.2.tgz
$ sudo ruby setup.rb


$ export PATH=$PATH:~/.gem/ruby/1.8/bin
$ source ~/.profile


● rvm(Ruby Version Manager)をインストール
rvmについて、ウェブサイト: Leex40のどをRubyでいっぱいにしてを参考にしました
$ sudo gem install rvm (rvm-1.6.20がインストールされた)
$ rvm-install ...これが動かない...


● Railsをインストール
$ sudo gem install rails
Railsはrails-3.0.9がインストールされた

もし'File not found: lib' と返ってくる場合は以下のようにRailsをインストールする
$ sudo gem install rails --no-ri --no-rdoc


● 実行してみる
$ rails new /home/xxx/photos
photosというディレクトリが作成され、そこに必要なものが生成されていた。見た目にはOk。

$ rails server
動作せず。エラーメッセージは:
Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
$ bundle install を実行するもエラーは変わらず
$ sudo apt-get install libsqlite3-dev 今回はこれでOk

● Rails3を使う記事など
ウェブサイト: Ruby on Rails3をはじめようubuntuとRails3ubuntuにRuby1.9.2とRails3をインストールした悪あがきプログラマー

2011年6月14日火曜日

Books!





ひとこと: アラスカへ渡った星野道夫氏の本。環太平洋の不思議な海流、民族の繋がり、厳しい自然と穏やかな時間  東京のカフェランチ~ 中央線編と東急線編。 カフェを始めるお話。 それと、「伝わる」写真を撮るヒント本。

2011年6月11日土曜日

youtube: Cool Stuffs for Summer Winds

● Going Down South / Bobby Hutcherson
from the album titled "San Francisco" (1970)
http://www.youtube.com/watch?v=OlpABKRL7UM&playnext=1&list=PLA640D08D5F11083F

● Summertime / Miles Davis
from the album "Porgy and Bass" (1958)
http://www.youtube.com/watch?v=N090STPx-2M&feature=autoplay&list=PLA640D08D5F11083F&index=20&playnext=3

● After the Rain / Ramsey Lewis
http://www.youtube.com/watch?v=cd6AlffYJi4&feature=related

● Chase the Clouds Away / Incognito
http://www.youtube.com/watch?v=u15dOPTZkec&feature=related

・also these links are on: http://galeriefb.blogspot.com/2011/06/youtube-cool-stuffs-for-summer-winds.html


* Images above are from YouTube containts

youtube: Da Kine

● Kanye West ft. Pusha-T "Runaway"

● Waka Flocka "Hard in Da Paint" (Offical Video)
http://www.youtube.com/watch?v=WkkC9cK8Hz0

● Nicki Minaj "Right Thru Me"
http://www.youtube.com/watch?v=5FJO6b8GL3M&feature=related

● Kanye West "Runaway" Full Length
http://www.youtube.com/watch?v=O7W0DMAx8FY&feature=related

* Images above are from YouTube containts themselves