LoginSignup
7
6

More than 5 years have passed since last update.

Rails sqlite3とgem sqliteのインストール

Last updated at Posted at 2014-06-18

古いCentOS Ver5.x系でrails環境を構築する際、sqlite3のインストールとgem sqlite3に躓いたので、その回避方法。
(前提としてyumできない環境)

1. sqlite のインストール

sqliteのソースファイルをダウンロードして、コンパイルする。


cd ~/
sudo wget http://www.sqlite.org/sqlite-autoconf~.tar.gz
tar xvfz sqlite-autoconf~.tar.gz
cd sqlite3 # ソースファイルのあるフォルダをsqlite3とする。
./configure
make
make install

参考

2. gem sqlite3のインストール

# Gemfile
gem sqlite3

上記のようにGemfileにsqlite3が記述されている状態で、bundle install を実行すると、sqlite3.hやlibなどが無いと
怒られるのでその回避策。

※ sqlite3-rubyは、sqlite3の旧バージョン


以下のコマンドで、sqlite3にオプションを指定できる。

bundle config build.sqlite3 --with-sqlite3-dir=$HOME/sqlite3 --with-sqlite3-include=$HOME/sqlite3 --with-sqlite3-lib=$HOME/sqlite3/.libs/ --with-opt-dir=$HOME/sqlite3

※--with-opt-dirは不要かもしれない。

bundle installで無事インストール完了。

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6