Ubuntu 9.04にRuby on Railsを入れる
うちのUbuntu実はRailsが入っていない。そういうや、入れてなかったっけ。びっくり。ということで、入れてみた。既にRuby、gemはインストール済み。
$ sudo apt-get install ruby $ sudo apt-get install rubygems
あれ、昔のメモを見るとrailsも入れてるっぽいが。気のせいか・・・。
Railsのインストールもapt-getで簡単に。
$ sudo apt-get install rails
と、これでRails2.1.0-6が入ったらしい。
適当なディレクトリに移動し、サンプルのプロジェクトを作ってみる。
$ rails sample-web /usr/lib/ruby/1.8/xmlsimple.rb:275: warning: already initialized constant KNOWN_OPTIONS /usr/lib/ruby/1.8/xmlsimple.rb:280: warning: already initialized constant DEF_KEY_ATTRIBUTES /usr/lib/ruby/1.8/xmlsimple.rb:281: warning: already initialized constant DEF_ROOT_NAME /usr/lib/ruby/1.8/xmlsimple.rb:282: warning: already initialized constant DEF_CONTENT_KEY /usr/lib/ruby/1.8/xmlsimple.rb:283: warning: already initialized constant DEF_XML_DECLARATION /usr/lib/ruby/1.8/xmlsimple.rb:284: warning: already initialized constant DEF_ANONYMOUS_TAG /usr/lib/ruby/1.8/xmlsimple.rb:285: warning: already initialized constant DEF_FORCE_ARRAY /usr/lib/ruby/1.8/xmlsimple.rb:286: warning: already initialized constant DEF_INDENTATION /usr/lib/ruby/1.8/xmlsimple.rb:287: warning: already initialized constant DEF_KEY_TO_SYMBOL create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create db create doc create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create script/process create test/fixtures create test/functional create test/integration create test/unit create vendor create vendor/plugins create tmp/sessions create tmp/sockets create tmp/cache create tmp/pids create Rakefile create README create app/controllers/application.rb create app/helpers/application_helper.rb create test/test_helper.rb create config/database.yml create config/routes.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/new_rails_defaults.rb create config/boot.rb create config/environment.rb create config/environments/production.rb create config/environments/development.rb create config/environments/test.rb create script/about create script/console create script/dbconsole create script/destroy create script/generate create script/performance/benchmarker create script/performance/profiler create script/performance/request create script/process/reaper create script/process/spawner create script/process/inspector create script/runner create script/server create script/plugin create public/dispatch.rb create public/dispatch.cgi create public/dispatch.fcgi create public/404.html create public/422.html create public/500.html create public/index.html create public/favicon.ico create public/robots.txt create public/images/rails.png create public/javascripts/prototype.js create public/javascripts/effects.js create public/javascripts/dragdrop.js create public/javascripts/controls.js create public/javascripts/application.js create doc/README_FOR_APP create log/server.log create log/production.log create log/development.log create log/test.log
と、警告が出るがちゃんと出来てるっぽい。
$ cd sample-web $ ruby script/server
と、WEBRickサーバを動かして、http://localhost:3000/へアクセスし動いているのを確認。
因みに、WEBRick起動時にも上に出てた警告がでるので調べてみると↓ここに解決策があった。
http://www.nabble.com/xmlsimple-warning-td20372818.html
ただ、ここでつかってるスクリプトだとうまく行かないので、直接ファイル(/usr/lib/ruby/1.8/lib/xmlsimple.rb)を以下の様に編集。
#require File.dirname(__FILE__) + '/../xmlsimple.rb' require 'lib/xmlsimple.rb'
これで警告はなくなったけど、あってるかどうかは未確認。