数年前まではいけたっぽいけど,今は無理みたい.
学会ページ作成のために,さくらレンタルサーバにRailsを導入して,Railsの勉強をしてみる.
基本的な手順は以下の通り.
- RubyGemsをインストール
- gemを使ってrailsをインストール
ただし,レンタルサーバなのでローカルに入れなければ行けない.
とりあえず,インストール場所は
~/local/bin
~/local/lib
以下にしてみる.
というわけで,以下手順.
RubyGemsをインストール
http://rubyforge.org/frs/?group_id=126で最新版を探してダウンロード
$ cd
$ mkdir src
$ cd src
$ wget http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz
インストールする場所を作成
$ mkdir local
$ tar zxvf rubygems-1.8.24.tgz
$ ruby setup.rb --prefix=$HOME/local/
RubyGems 1.8.24 installed == 1.8.24 / 2012-04-27 * 1 bug fix: * Install the .pem files properly. Fixes #320 * Remove OpenSSL dependency from the http code path ------------------------------------------------------------------------------ RubyGems installed the following executables: /home/name/local/bin/gem18$ cd
$ emacs .cshrc
... set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/\ bin $HOME/local/bin) setenv RUBYLIB $HOME/local/lib setenv GEM_HOME $HOME/local/lib/ruby/gem$ sources .cshrc
$ gem --version
1.8.24
Railsをインストール
$ gem18 install rails --include-dependencieschown/chgrp: Operation not permittedエラーだ.
解決策はこちら
http://playet.jugem.jp/?eid=56
$ setenv RB_USER_INSTALL true
$ gem18 install rails --include-dependencies
成功したように見えるのに,なぜかrailsが入っていない.
おや?
Pathに
$HOME/local/lib/ruby/gem/bin
が必要だった.
.cshrcに追加
... set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin $HOME/local/bin $HOME/local/lib/ruby/gem/bin)$ source .cshrc
$ rails -v
Rails 3.2.6
お~.できたできた.
それじゃ,早速アプリケーションを作成してみましょうかね.
$ cd
$mkdir Rails
$ rails new HelloWolrd
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby18 extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite-devel' and check your shared library search path (the location where your sqlite3 shared library is located). *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby18 --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib --enable-local --disable-local Gem files will remain installed in /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6 for inspection. Results logged to /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.おや?
続けていくと,次々怒られるので,順番にgemでインストールしていって見る.
$ gem18 install coffee-script
$ gem18 install coffee-rails
$ gem18 install sass
$ gem18 install sass-rails
$ gem18 install sqlite3
ここまで順調だったが,ここで問題発生.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.だけど,さくらに入っているのはsqlite3 ver 3.7.9 20
とりあえず古いバージョンをインストールしてみる.
$ gem install sqlite3-ruby --version=1.2.4
$ rails new HelloWorld
... Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby18 extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite-devel' and check your shared library search path (the location where your sqlite3 shared library is located). *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby18 --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib --enable-local --disable-local Gem files will remain installed in /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6 for inspection. Results logged to /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.調べてみると,結構インストールのやり方が出てくるけど,皆情報が古い.
ここ1年で検索してみると,
http://okwave.jp/qa/q5323794.html
http://d.hatena.ne.jp/ar_tama/20120212/1329027876
を見る限り無理っぽい
なんてこったい.