QNAP TS-239にRailsをインストールしてみる(1)

TS-239を放置しておくのもなんなので、試しにRailsをインストールしてみる。

Optware IPKGをインストール

  1. 管理ページにログイン
  2. [Applications] - [QPKG Plugins]を選択し、GET QPKGボタンを押下
  3. Optware IPKG (Itsy Package Management System)をダウンロードする。
  4. 解凍してInstallationタブの[ファイルを選択]ボタンでアップロードする。
  5. [INSTALLボタンを押下]

ruby 1.8.7 インストール

  1. wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p302.tar.gz
  2. tar zxvf ruby-1.8.7-p302.tar.gz
  3. cd ruby-1.8.7-p302
  4. ipkg install gcc

ここまで実行して ./configure を実行したところ、"checking for grep that handles long lines and -e... configure: error: no acceptable grep could be found" というエラーが発生。

  1. ipkg install grep
  2. rm /bin/grep

ここまで実行して ./configure を実行したところ、今度は以下のエラーが発生。
"awk: ./confOiyPJQ/subs.awk:2: Unexpected token"
"config.status: error: could not create Makefile"

  1. ipkg install gawk
  2. rm /bin/awk
  3. ipkg install sed
  4. rm /bin/sed
  5. ./configure --prefix=/opt
  6. ipkg install make
  7. make
  8. make install

動作確認

[/share/Public/rubygems-1.3.7] # which ruby
/opt/bin/ruby
[/share/Public/rubygems-1.3.7] # ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
[/share/Public/rubygems-1.3.7] #

rubygems 1.3.7 インストール

  1. wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
  2. tar zxvf rubygems-1.3.7.tgz
  3. cd rubygems-1.3.7.tgz
  4. ruby setup.rb

動作確認

[/share/Public/rubygems-1.3.7] # which gem
/opt/bin/gem
[/share/Public/rubygems-1.3.7] # gem -v
1.3.7
[/share/Public/rubygems-1.3.7] #

rails 2.3.5 インストール

[/share/Public/ruby-1.8.7-p302] # gem install rails --version "2.3.5"
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
[/share/Public/ruby-1.8.7-p302] #

gem使うとno such file to load -- zlibというエラーがでる - 橋本詳解を参考に、以下のように対処。

  1. ipkg install zlib
  2. cd ruby-1.8.7-p302/ext/zlib
  3. ruby extconf.rb
  4. make
  5. make install
[/share/Public/ruby-1.8.7-p302/ext/zlib] # gem install rails --version "2.3.5"
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.5...
Installing ri documentation for activerecord-2.3.5...
Installing ri documentation for rack-1.0.1...
Installing ri documentation for actionpack-2.3.5...
Installing ri documentation for actionmailer-2.3.5...
Installing ri documentation for activeresource-2.3.5...
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.5...
Installing RDoc documentation for activerecord-2.3.5...
Installing RDoc documentation for rack-1.0.1...
Installing RDoc documentation for actionpack-2.3.5...
Installing RDoc documentation for actionmailer-2.3.5...
Installing RDoc documentation for activeresource-2.3.5...
Installing RDoc documentation for rails-2.3.5...
[/share/Public/ruby-1.8.7-p302/ext/zlib] # rails --version
Rails 2.3.5
[/share/Public/ruby-1.8.7-p302/ext/zlib] #

MySQL の有効化

とりあえずMySQLを有効化するところまで。

  1. ln -s /opt/bin/sed /bin/sed
  2. ln -s /opt/bin/grep /bin/grep
  3. MySQLを有効化