下载 rubyee http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
注意:安装rubyee 之前需要有ruby 环境,因为rubyee 的生成需要ruby 编译。(不知道为什么,ubuntu 下始终没有配好过。)
1、tar xzvf ruby-enterprise-X.X.X.tar.gz
2、./ruby-enterprise-X.X.X/installer
3、配置环境变量vim /etc/profile
在后面加上PATH=/opt/rubyee(rubyee的安装目录)/bin:$PATH
export PATH
如果使用的是rubyee默认安装的话,rails目前是2.3.8,为了和我们之前的2.3.5一致,我卸载了rails2.3.8
gem uninstall rails
以及rails相关联的actionmails-2.3.8等等。
Gem install rails --version=2.3.5
安装odbc和freetds
yum install freetds-devel unixODBC-devel
安装 ruby-odbc
gem install ruby-odbc
gem install dbd-odbc
gem install dbi
安装sqlserver的适配器
gem install activerecord-sqlserver-adapter
配置FreeTDS
/etc/freetds/freetds.conf
[YOUR_DB_DEFINITION_NAME]
host = <HOST NAME/IP ADDRESS>
port = <PORT NUMBER>
tds version = 8.0
client charset = UTF-8
测试下freetds是否成功
tsql -S YOUR_DB_DEFINITION_NAME -U USERNAME -P PASSWORD
or
sqsh -S YOUR_DB_DEFINITION_NAME -U USERNAME -P PASSWORD
配置数据库ODBC
/etc/odbc.ini
[YOUR_DB_DEFINITION_NAME]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = YOUR_DB_DEFINITION_NAME
Database = YOUR_ACTUAL_DB_NAME
/etc/odbcinst.ini
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
测试下ODBC是否正确
isql YOUR_DB_DEFINITION_NAME USER PASSWORD
安装 passenger
rubyee会默认安装passenger的gem
所以只需要执行passenger-install-nginx-module
这样也可以自动安装nginx了。
到此基本完成了,到此基本搭架完成了。
参 考:http://wiki.rubyonrails.org/database-support/ms-sql (linux odbc ruby mssql)
http://www.rubyenterpriseedition.com/ (rubyee)
http://www.modrails.com/ (passenger )