2007年8月17日金曜日

CentOSにRailsをインストール

Railsをインストール。

Ruby、RubyGemsのインストールが無事に終わったので、Railsをいれます。

■gemsコマンドでRailsをインストール

Ruby、RubyGems入ってる。
[root@mycentos ~]# gem -v
0.9.4
[root@mycentos ~]# ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]


gemsコマンド実行
[root@mycentos ~]# gem install rails


あらら、エラーがでた。
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository


ちょっと調べたら、引数をつけないと駄目なようでした。再度コマンド
[root@mycentos ~]# gem install rails --include-dependencies


うまくいった。
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.2.3
Successfully installed rake-0.7.3
Successfully installed activesupport-1.4.2
Successfully installed activerecord-1.15.3
Successfully installed actionpack-1.13.3
Successfully installed actionmailer-1.3.3
Successfully installed actionwebservice-1.2.3
Installing ri documentation for rake-0.7.3...
Installing ri documentation for activesupport-1.4.2...
Installing ri documentation for activerecord-1.15.3...
Installing ri documentation for actionpack-1.13.3...
Installing ri documentation for actionmailer-1.3.3...
Installing ri documentation for actionwebservice-1.2.3...
Installing RDoc documentation for rake-0.7.3...
Installing RDoc documentation for activesupport-1.4.2...
Installing RDoc documentation for activerecord-1.15.3...
Installing RDoc documentation for actionpack-1.13.3...
Installing RDoc documentation for actionmailer-1.3.3...
Installing RDoc documentation for actionwebservice-1.2.3...
[root@mycentos ~]#


ブラウザで確認できるか簡単なWEBrickを起動してみる。
[root@mycentos ~]# mkdir raily
[root@mycentos ~]# cd raily
[root@mycentos raily]# rails hello
create
create app/controllers
      ・
      ・
      ・
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log
[root@mycentos raily]# cd hello
[root@mycentos hello]# ruby script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-08-16 16:42:37] INFO WEBrick 1.3.1
[2007-08-16 16:42:37] INFO ruby 1.8.6 (2007-03-13) [x86_64-linux]
[2007-08-16 16:42:37] INFO WEBrick::HTTPServer#start: pid=16006 port=3000




ポート3000にアクセスし、無事に見れました。ポートを変えたいときは引数を付けて起動する例えば、--port=3210
Ctrl+CでWEBrickを停止する。

[2007-08-16 16:43:30] INFO going to shutdown ...
[2007-08-16 16:43:30] INFO WEBrick::HTTPServer#start done.
[root@mycentos hello]#

0 件のコメント: