Ruby on Rails 環境の導入

CentOS 5.5 に Ruby on Rails 環境を導入する。

  • Ruby 1.9.2 p180
  • SQLite 3.7.5
  • Rails 3.2.1

Ruby のインストール

# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
# tar xvzf ruby-1.9.2-p180.tar.gz
# cd ruby-1.9.2-p180
# ./configure
# make -j2
# make install

PATH が通ってなかったので ~/.bash_profile を編集。

# emacs -nw ~/.bash_profile
...
PATH=$PATH:$HOME/bin:/usr/local/bin
export PATH
# source ~/.bash_profile
# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

Ruby のインストールおわり。

SQLite のインストール

# wget [http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz](http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz)
# tar zxvf sqlite-autoconf-3070500.tar.gz
# cd sqlite-autoconf-3071000
# ./configure
# make -j2
# make install
# sqlite3 -version
3.3.6

version 3.7.5 になってない…?

# /usr/local/bin/sqlite3 -version
/usr/local/bin/sqlite3: symbol lookup error: /usr/local/bin/sqlite3: undefined symbol: sqlite3_config

make install 時のログをみると…

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

   If you ever happen to want to link against installed libraries
   in a given directory, LIBDIR, you must either use libtool, and
   specify the full pathname of the library, or use the `-LLIBDIR'
   flag during linking and do at least one of the following:
      - add LIBDIR to the `LD_LIBRARY_PATH' environment variableduring execution
      - add LIBDIR to the `LD_RUN_PATH' environment variableduring linking
      - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
      - have your system administrator add LIBDIR to `/etc/ld.so.conf'

   See any operating system documentation about shared libraries for
   more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

ライブラリが既にインストールされてるとかなんとか…
./configureprefix=/usr/ を付ければ行けそう (参考:http://sisomoti.blog76.fc2.com/blog-entry-15.html)。 ということで、再チャレンジ!

# ./configure --prefix=/usr/
# make -j2
# make install
# sqlite3 -version 
3.7.5

よしよしできたできた。
つぎは SQLite の Ruby用アダプタのインストール

# gem install sqlite3
Building native extensions.  This could take a while...
Successfully installed sqlite3-1.3.5
1 gem installed
...
(以下省略)

SQLite のインストールおわり。

Rails のインストール

# gem install rails
...
Successfully installed i18n-0.6.0
Successfully installed multi_json-1.1.0
Successfully installed activesupport-3.2.1
(中略)
Successfully installed railties-3.2.1
Successfully installed bundler-1.0.22
Successfully installed rails-3.2.1
30 gems installed
(以下省略)

一応バージョン確認

# rails -v
Rails 3.2.1

Rails のインストールもおわり。

Comments