ubuntu rails3 部署 oracle

rvm 安装

curl -L get.rvm.io | bash -s stable

source ~/.rvm/scripts/'rvm'

查看ruby依赖包
 rvm requirements

引用
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
  ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

sudo apt-get install ..(复制后面所有的依赖包)



sudo apt-get install libaio1
    # ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 library or gem.
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in
`establish_connection':RuntimeError: Please install the oracle_enhanced adapter:
`gem install activerecord-oracle_enhanced-adapter` (LoadError)

rvm package install zlib ;   
rvm package install readline;  
rvm package install openssl;  
rvm package install iconv;  


ruby 安装
rvm install 1.9.2 -C --with-zlib-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr 




rvm list


rvm rubies

=> ruby-1.9.2-p180 [ i386 ]

设置默认使用的版本
rvm 1.9.2 --default


gem install rails
   # ERROR:  While executing gem .(Errno::EACCES)

sudo chown [用户名] ~/.gem -R

    Permission denied - /home/demon/.gem/specs

gem install activerecord-oracle-adapter -- source http://gems.rubyonrails.org


cd ~/.rvm/src/ruby-1.9.2-head/ext/openssl


ruby extconf.rb


cd ../..

make

make install


配置oracle数据库
下载 instantclient-sdk-linux32-11.2.0.2.0
     instantclient-basic-linux32-11.2.0.2.0( http://download.oracle.com/otn/linux/instantclient/112020/instantclient-basic-linux32-11.2.0.2.0.zip)
     ruby-oci8-2.0.4.gem
创建目录(随便放哪都一样,关键最后指定环境变量就行)
sudo mkdir /opt/orcle

进入目录
cd /opt/oracle

unzip /#之前下的三个文件的路径/to/instantclient-basic-linux32-11.2.0.2.0.zip
unzip /#之前下的三个文件的路径/to/instantclient-sdk-linux32-11.2.0.2..zip


进入解压的文件
cd /opt/oracle/instantclient11_2
sudo ln -s libclntsh.so.11.1 libclntsh.so
  # 如果不是这个版本,会有错误提示的正确版本

设置环境变量
export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2


进入之前下载的三个文件目录下
cd ~/Downloads
gem install ruby-oci8-2.0.4.gem



最好把这个也安装好  http://ddl1st.iteye.com/blog/962881

你可能感兴趣的:(java,oracle,git,ubuntu,Ruby)