rubygems, rails, sqlite3インストール

さくらインターネットレンタルサーバースタンダードプランが容量1GB→3GBになったので、RailsFastladderを入れてみたい

  • さくらに最初から入っているrubyを使う
  • rubygemsはソースからインストールする
  • DBはSQLite3
  • railsmongrelで起動できるのかな?


参考:がんちゃんのブログ: さくらのレンタルサーバーにRuby on Rails 2.0.2をインストールする方法
http://rubyforge.org/frs/?group_id=126 より

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar -zxvf rubygems-1.3.1.tgz
cd rubygems-1.3.1/
ruby setup.rb --prefix=$HOME/local
If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

~/bin/gem18が入った


~/.zshrc に追記

export RUBYLIB=$HOME/local/lib
export GEM_HOME=$HOME/local/lib/ruby/gem
cd ~/local/bin/
mv gem18 gem

railsをインストール
gem install rails --include-dependencies

Successfully installed rake-0.8.3
Successfully installed activesupport-2.2.2
Successfully installed activerecord-2.2.2
Successfully installed actionpack-2.2.2
Successfully installed actionmailer-2.2.2
Successfully installed activeresource-2.2.2
Successfully installed rails-2.2.2
7 gems installed
Installing ri documentation for rake-0.8.3...
Installing ri documentation for activesupport-2.2.2...
Installing ri documentation for activerecord-2.2.2...
Installing ri documentation for actionpack-2.2.2...
Installing ri documentation for actionmailer-2.2.2...
Installing ri documentation for activeresource-2.2.2...
Installing RDoc documentation for rake-0.8.3...
Installing RDoc documentation for activesupport-2.2.2...
Installing RDoc documentation for activerecord-2.2.2...
Installing RDoc documentation for actionpack-2.2.2...
Installing RDoc documentation for actionmailer-2.2.2...
Installing RDoc documentation for activeresource-2.2.2...


パスの通っているディレクトリにシンボリックリンクはっておく

ln -s ~/local/lib/ruby/gem/bin/rails ~/bin/rails
ln -s ~/local/lib/ruby/gem/bin/rake ~/bin/rake

SQLite3関連をインストールする。

まず本体
参考:Sakura サーバに Sqlite3 をインストールしてみる - Rubyの魔神 - はてな?Rubyグループ

wget http://sqlite.org/sqlite-3.6.6.2.tar.gz
tar -zxvf sqlite-3.6.6.2.tar.gz
cd sqlite-3.6.6.2/
./configure --prefix=$HOME/local
make
make install


gemからはsqlite3-rubyが入らないのでソースから
参考:さくらに fastladder 入れようとする - 御玉杓子スパイラル

wget http://rubyforge.org/frs/download.php/42056/sqlite3-ruby-1.2.4.tar.gz
tar -zxvf sqlite3-ruby-1.2.4.tar.gz
cd sqlite3-ruby-1.2.4/
ruby setup.rb config --prefix=$HOME/local
ruby setup.rb setup
ruby setup.rb install


sqlite3-rubyをパスの通っている所にコピーする

cp -R ~/local/lib/ruby/site_ruby/1.8/* ~/local/lib/

なんか気持ち悪いな。.zshrcでexport RUBYLIBを複数指定する方法がわかればこれはいらないんだけど



RailsでBBSを作ってみる - 橋本詳解を参考に、railsアプリを作ってみる。

mkdir ~/rails
cd ~/rails
rails testbbs
ruby script/generate scaffold message name:string body:text
rake db:migrate
./script/server

これで http://hostname:3000/messageswebrickrailsアプリが起動した
できればmongrel入れたい。