`
wuhuizhong
  • 浏览: 684522 次
  • 性别: Icon_minigender_1
  • 来自: 中山
社区版块
存档分类
最新评论

在RHEL上安裝設置ROR(nginx+passenger+ruby+rails+oracle+netzke)

    博客分类:
  • ROR
阅读更多

======================================================================================================
下載ruby-enterprise到/opt/ror
http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz

解壓ruby-enterprise
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
安裝ruby-enterprise
./ruby-enterprise-1.8.7-2010.02/installer

移除舊版ruby
mv /usr/bin/ruby /usr/bin/ruby1.8.7

更新版ruby
------------------------------------------------------------------------------
root用戶登錄修改PATH:
# cd ~
# vi .bash_profile
PATH=$PATH:$HOME/bin:/opt/ruby-enterprise-1.8.7-2010.02/bin
# chown -R oracle /opt/ruby-enterprise-1.8.7-2010.02/
# chown -R oracle /opt/ror/
# chown -R oracle rails_apps/
oracle用戶登錄
$ vi .profile.custom.noninteractive
加入一行:
export PATH=/opt/ruby-enterprise-1.8.7-2010.02/bin:$PATH
------------------------------------------------------------------------------
cp /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby /usr/bin/
cp /opt/ruby-enterprise-1.8.7-2010.02/bin/gem /usr/bin/
ruby -v
gem -v
gem list -l

下載passenger-3.0.2.gem到/opt/ror/gems
http://rubygems.org/downloads/passenger-3.0.2.gem

安裝passenger
gem install passenger-3.0.2.gem -l --no-ri --no-rdoc

再執行一次安裝ruby-enterprise
./ruby-enterprise-1.8.7-2010.02/installer
--------------------------------------------
Ruby Enterprise Edition is successfully installed!
If want to use Phusion Passenger (http://www.modrails.com) in combination
with Ruby Enterprise Edition, then you must reinstall Phusion Passenger against
Ruby Enterprise Edition, as follows:

  /opt/ruby-enterprise-1.8.7-2010.02/bin/passenger-install-apache2-module

Make sure you don't forget to paste the Apache configuration directives that
the installer gives you.


If you ever want to uninstall Ruby Enterprise Edition, simply remove this
directory:

  /opt/ruby-enterprise-1.8.7-2010.02
 
創建可執行文件: /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby_with_env
#!/bin/bash
export ORACLE_HOME=/opt/oracle/eesrv/10.2.0/db1
export LD_LIBRARY_PATH=/opt/oracle/otk/1.0/lib/:/opt/oracle/otk/1.0/lib:/opt/oracle/eesrv/10.2.0/db1/lib32:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export SQLPATH=$LD_LIBRARY_PATH
export TNS_ADMIN=/opt/oracle/network
export NLS_LANG=AMERICAN_AMERICA.UTF8
/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby $*
======================================================================================================
安裝rails3.0.3
gem install -l --no-ri --no-rdoc rails-3.0.3.gem
        actionpack requires activemodel (= 3.0.3, runtime)
        activemodel requires builder (~> 2.1.2, runtime)
        activemodel requires i18n (~> 0.4, runtime)
        actionpack requires rack-test (~> 0.5.6, runtime)
        actionpack requires rack-mount (~> 0.6.13, runtime)
        actionpack requires tzinfo (~> 0.3.23, runtime)
        actionpack requires erubis (~> 2.6.6, runtime)
        erubis requires abstract (>= 1.0.0, runtime)
        activerecord requires arel (~> 2.0.2, runtime)
        actionmailer requires mail (~> 2.2.9, runtime)
        mail requires mime-types (~> 1.16, runtime)
        mail requires treetop (~> 1.4.8, runtime)
        treetop requires polyglot (>= 0.3.1, runtime)
        mail requires i18n (~> 0.4.1, runtime)

安裝相關gems
gem install -l --no-ri --no-rdoc haml-3.0.25.gem
gem install -l --no-ri --no-rdoc coderay-0.9.
gem install -l --no-ri --no-rdoc coderay-0.9.6.gem
gem install -l --no-ri --no-rdoc fa
gem install -l --no-ri --no-rdoc faker-0.9.4.gem
gem install -l --no-ri --no-rdoc inploy-1.9.gem
gem install -l --no-ri --no-rdoc will_paginate-
gem install -l --no-ri --no-rdoc will_paginate-3.0.pre2.gem
gem install -l --no-ri --no-rdoc i18n-0.5.0.gem
gem install -l --no-ri --no-rdoc treetop-1.4.9.gem
gem install -l --no-ri --no-rdoc mail-2.2.13.gem
gem install -l --no-ri --no-rdoc arel-2.0.6.gem
gem install -l --no-ri --no-rdoc faker-0.9.2.gem
gem install -l --no-ri --no-rdoc inploy-1.8.gem
gem install -l --no-ri --no-rdoc open4-1.0.1.gem
gem install -l --no-ri --no-rdoc perftools.rb-0.5.4.gem
gem install -l --no-ri --no-rdoc rack-perftools_profiler-0.2.1.gem
gem install -l --no-ri --no-rdoc thor-0.14.6.gem
gem install -l --no-ri --no-rdoc meta_where-0.9.10.gem

Oracle相關gems
gem install -l --no-ri --no-rdoc activerecord-oracle_enhanced-adapter-1.3.2.gem
gem install -l --no-ri --no-rdoc activerecord-oracle_enhanced-adapter-1.3.1.gem
gem install -l --no-ri --no-rdoc ruby-oci8-2.0.4.gem
gem install -l --no-ri --no-rdoc ruby-plsql-0.4.4.gem
gem install -l --no-ri --no-rdoc oracle_enhanced-1.3.2.gem

Netzke相關gems
gem install -l --no-ri --no-rdoc netzke-core-0.6.4.gem
gem install -l --no-ri --no-rdoc netzke-basepack-0.6.2.gem
gem install -l --no-ri --no-rdoc netzke-persistence-0.1.0.gem

#测试
ruby -r oci8 -e "OCI8.new('netzke','practice').exec('select * from users') do |r| puts r.join(',');end"

======================================================================================================
下載Ext JS 3.3.1
http://www.sencha.com/products/js/download.php
unzip ext-3.3.1.zip

======================================================================================================
安裝netzke-demo
# cd /opt
# mkdir rails_apps
# chown oracle rails_apps/
# su - oracle
$ cp netzke-demo.tar.gz /opt/rails_apps/
$ cp netzke-core-v0.6.4-61.tar.gz /opt/rails_apps/
$ cp netzke-basepack-v0.6.2-58.tar.gz /opt/rails_apps/
$ cd /opt/rails_apps
$ tar zxvf netzke-demo.tar.gz
$ tar zxvf netzke-core-v0.6.4-61.tar.gz
$ tar zxvf netzke-basepack-v0.6.2-58.tar.gz
$ mv skozlov-netzke-demo-d88bf76 netzke-demo
$ mv skozlov-netzke-core-4476578 netzke-demo/vendor/plugins/netzke_core
$ mv skozlov-netzke-basepack-94aaf03 netzke-demo/vendor/plugins/netzke_basepack
$ cd netzke-demo

--------------------------------------------------------------------------------
$ vi Gemfile
source 'http://rubygems.org'

gem 'rails', '~>3.0.3'

#gem 'mysql2'
gem 'ruby-oci8', ">= 2.0.4"
gem "activerecord-oracle_enhanced-adapter", "~>1.3.2"

# optionally also use ruby-plsql
gem "ruby-plsql", ">=0.4.4"

gem 'haml'

gem 'coderay'
gem 'faker'

gem 'netzke-core' #, :git => "git://github.com/skozlov/netzke-core.git"
gem 'netzke-basepack' #, :git => "git://github.com/skozlov/netzke-basepack.git"
gem 'netzke-persistence' #, :git => "git://github.com/skozlov/netzke-persistence.git"

gem 'inploy'

gem 'will_paginate', '~>3.0.pre2'

group :profiling do
  gem 'rack-perftools_profiler', '~> 0.1', :require => 'rack/perftools_profiler'
end
--------------------------------------------------------------------------------

Install required gems
$ bundle
$ bundle install
$ bundle show
Gems included by the bundle:
  * abstract (1.0.0)
  * actionmailer (3.0.3)
  * actionpack (3.0.3)
  * activemodel (3.0.3)
  * activerecord (3.0.3)
  * activerecord-oracle_enhanced-adapter (1.3.2)
  * activeresource (3.0.3)
  * activesupport (3.0.3)
  * acts_as_list (0.1.2)
  * arel (2.0.6)
  * builder (2.1.2)
  * bundler (1.0.7)
  * coderay (0.9.6)
  * erubis (2.6.6)
  * faker (0.9.2)
  * haml (3.0.25)
  * i18n (0.5.0)
  * inploy (1.8)
  * mail (2.2.13)
  * meta_where (0.9.10)
  * mime-types (1.16)
  * netzke-basepack (0.6.2)
  * netzke-core (0.6.4)
  * netzke-persistence (0.1.0)
  * open4 (1.0.1)
  * perftools.rb (0.5.4)
  * polyglot (0.3.1)
  * rack (1.2.1)
  * rack-mount (0.6.13)
  * rack-perftools_profiler (0.2.1)
  * rack-test (0.5.6)
  * rails (3.0.3)
  * railties (3.0.3)
  * rake (0.8.7)
  * ruby-oci8 (2.0.4)
  * ruby-plsql (0.4.4)
  * thor (0.14.6)
  * treetop (1.4.9)
  * tzinfo (0.3.23)
  * will_paginate (3.0.pre2)

--------------------------------------------------------------------------------
$ ln -s /opt/ror/ext-3.3.1 public/extjs

$ vi config/database.yml
development: &development
  adapter: oracle_enhanced
  database: test
  username: netzke_demo
  password: practice

test:
  adapter: oracle_enhanced
  database: test
  username: netzke_demo
  password: practice

production:
  adapter: oracle_enhanced
  database: test
  username: netzke_demo
  password: practice
 
$ rake db:create && rake db:migrate

$ rails server

======================================================================================================
運行netzke-demo
http://172.18.60.39:3000/
see the error : uninitialized constant Netzke::Basepack::SimpleApp
replace Netzke::Basepack::SimpleApp as Netzke::Basepack::BorderLayoutPanel
then work.
$ vi app/components/some_simple_app.rb

production需注釋config.serve_static_assets = false
$ rails server -e production
$ vi config/environments/production.rb
  # Disable Rails's static asset server
  # In production, Apache or nginx will already do this
  # config.serve_static_assets = false

======================================================================================================
安裝 nginx
下載安裝prce
http://sourceforge.net/projects/pcre/files/
# tar zxvf pcre-8.11.tar.gz 
# ./configure 
# make 
# make install

下載nginx
http://nginx.org/download/nginx-0.8.53.tar.gz
# tar zxvf nginx-0.8.53.tar.gz
# mkdir nginx
# chown oracle nginx

--------------------------------------------------------------------------------
安裝 passenger-install-nginx-module
$ passenger-install-nginx-module
Welcome to the Phusion Passenger Nginx module installer, v3.0.2.

This installer will guide you through the entire installation process. It
shouldn't take more than 5 minutes in total.

Here's what you can expect from the installation process:

 1. This installer will compile and install Nginx with Passenger support.
 2. You'll learn how to configure Passenger in Nginx.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * The 'make' tool... found at /usr/bin/make
 * A download tool like 'wget' or 'curl'... found at /usr/bin/wget
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /opt/ruby-enterprise-1.8.7-2010.02/bin/rake
 * rack... found
 * Curl development headers with SSL support... found
 * OpenSSL development headers... found
 * Zlib development headers... found

--------------------------------------------

Automatically download and install Nginx?

Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.

Do you want this installer to download, compile and install Nginx for you?

 1. Yes: download, compile and install Nginx for me. (recommended)
    The easiest way to get started. A stock Nginx 0.8.53 with Passenger
    support, but with no other additional third party modules, will be
    installed for you to a directory of your choice.

 2. No: I want to customize my Nginx installation. (for advanced users)
    Choose this if you want to compile Nginx with more third party modules
    besides Passenger, or if you need to pass additional options to Nginx's
    'configure' script. This installer will  1) ask you for the location of
    the Nginx source code,  2) run the 'configure' script according to your
    instructions, and  3) run 'make install'.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

Enter your choice (1 or 2) or press Ctrl-C to abort: 2
--------------------------------------------

Where is your Nginx source code located?

Please specify the directory: /opt/ror/nginx-0.8.53
--------------------------------------------

Where do you want to install Nginx to?

Please specify a prefix directory [/opt/nginx]:

--------------------------------------------

Extra Nginx configure options

If you want to pass extra arguments to the Nginx 'configure' script, then
please specify them. If not, then specify nothing and press Enter.

If you specify nothing then the 'configure' script will be run as follows:

  sh ./configure --prefix='/opt/nginx' --with-http_ssl_module --add-module='/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/nginx'

Extra arguments to pass to configure script:
--------------------------------------------

Confirm configure flags

The Nginx configure script will be run as follows:

  sh ./configure --prefix='/opt/nginx' --with-http_ssl_module --add-module='/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2/ext/nginx'

Is this what you want? (yes/no) [default=yes]:
--------------------------------------------

Nginx with Passenger support was successfully installed.

The Nginx configuration file (/opt/nginx/conf/nginx.conf)
must contain the correct configuration options in order for Phusion Passenger
to function correctly.

This installer has already modified the configuration file for you! The
following configuration snippet was inserted:

  http {
      ...
      passenger_root /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2;
      passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby;
      ...
  }

After you start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.

Press ENTER to continue.
--------------------------------------------

Deploying a Ruby on Rails application: an example

Suppose you have a Ruby on Rails application in /somewhere. Add a server block
to your Nginx configuration file, set its root to /somewhere/public, and set
'passenger_enabled on', like this:

   server {
      listen 80;
      server_name www.yourhost.com;
      root /somewhere/public;   # <--- be sure to point to 'public'!
      passenger_enabled on;
   }

And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:

  /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2/doc/Users guide Nginx.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
--------------------------------------------------------------------------------

設置 /opt/nginx/conf/nginx.conf
http {
    passenger_root /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-3.0.2;
    passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby;
    passenger_default_user oracle;

   server {
        listen       3002;
        server_name  172.18.60.39;
        root /opt/rails_apps/netzke-demo/public;
        passenger_enabled on;
        rails_env development;
   }
}

--------------------------------------------
設置 start and stop nginx with init script:
git clone git://github.com/xdite/rails-nginx-passenger-centos.git
mv rails-nginx-passenger-centos/nginx/nginx /etc/init.d/nginx
chown root:root /etc/init.d/nginx
/etc/init.d/nginx start
/etc/init.d/nginx status
/etc/init.d/nginx stop
/sbin/chkconfig nginx on

--------------------------------------------
apache/nginx+passenger+ruby+rails+oracle的关键步骤
在配置passenger的时候一定要记住以下一行话:
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.8;
passenger_ruby /usr/local/bin/ruby;
上面两行应该100%的人都加了,但是下面这行,是重中之重:
 passenger_default_user oracle;
这个千万要加上,不然连不上oracle.

--------------------------------------------
OCI Library Initialization Error

http://wiki.github.com/rsim/oracle-enhanced/troubleshooting

Using mod_rails with Rails applications on Oracle
Oracle/OCI libraries could not be loaded: libclntsh.so.10.1: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/site_ruby/1.8/x86_64-linux/oci8lib.so

創建可執行文件: /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby_with_env
#!/bin/bash
export ORACLE_HOME=/opt/oracle/eesrv/10.2.0/db1
export LD_LIBRARY_PATH=/opt/oracle/otk/1.0/lib/:/opt/oracle/otk/1.0/lib:/opt/oracle/eesrv/10.2.0/db1/lib32:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export SQLPATH=$LD_LIBRARY_PATH
export TNS_ADMIN=/opt/oracle/network
export NLS_LANG=AMERICAN_AMERICA.UTF8
/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby $*
更改配置文件: Apache httpd.conf(nginx nginx.conf)
# passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby;
passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby_with_env;   
======================================================================================================

分享到:
评论

相关推荐

    RHEL 8.4 安装Oracle 19c RAC+RU 19.13 文档.docx

    文档主要记录Red Hat Enterprise Linux Server release 8.4上安装19c RAC + RU 19.13 步骤

    nginx+php+oracle安装配置

    在安装PHP时,确保选择与Oracle数据库兼容的版本,例如PHP 7.x: ```bash sudo apt-get install php-fpm php-mysqlnd 或 sudo yum install php-fpm php-mysqlnd ``` 如果需要支持Oracle数据库,还需要安装oci8扩展...

    RHEL8安装oracle19C数据库详细步骤.docx

    在安装 Oracle 数据库之前,需要进行一些准备工作,包括创建 RAID5 磁盘阵列、配置 YUM 源仓库、安装 Oracle 数据库相关依赖包和上传中文字体到 Red Hat 服务器等。 1.1 创建 RAID5 磁盘阵列 创建 RAID5 磁盘阵列...

    RHEL5.5+drbd+heartbeat+oracle10R2 双机安装实例

    RHEL5.5+drbd+heartbeat+oracle10R2 双机安装实例

    rhel+nginx+portal

    "RHEL+nginx+portal"的组合正是这样一个解决方案,它将Red Hat Enterprise Linux操作系统、Nginx Web服务器和Portal服务融合在一起,为企业提供了稳定、高性能的平台。 **RHEL(Red Hat Enterprise Linux)** RHEL...

    RHEL9 + Nginx + Lua

    RHEL9 + Nginx 1.24 + Lua 资源包

    RHEL+7.6+安装Oracle19C+ASM+dataguard超强安装指南

    本指南旨在指导用户在 RHEL 7.6 环境中安装 Oracle 19C ASM Dataguard,以实现高可用性和高性能的数据库环境。 硬件需求 * CPU:4 核心 * 内存:20G * 存储:200G 软件环境 * 操作系统:RHEL 7.6 (Maipo) * ...

    rhel5.1+oracle10g+rac所需rpm

    【标题】"rhel5.1+oracle10g+rac所需rpm" 指的是在Red Hat Enterprise Linux (RHEL) 5.1版本上安装Oracle 10g数据库并构建Real Application Clusters (RAC)环境所需的一系列RPM(Red Hat Package Manager)软件包。...

    源码安装nginx+keepalived实现HA(高可用)

    在本篇文章中,我们将详细介绍如何通过源码安装的方式部署Nginx与Keepalived来构建一个高可用(High Availability,简称HA)的Web服务集群。这种方式相比于传统的编译安装更为简便高效,能够有效提升系统稳定性和...

    Linux下Nginx+PHP+MySQL配置(图)

    1. **安装Nginx**:在Linux上,通常使用包管理器如`apt`(Ubuntu/Debian)或`yum`(CentOS/RHEL)来安装Nginx。执行相应的命令,例如`sudo apt-get install nginx`或`sudo yum install nginx`。 2. **安装PHP**:...

    RHEL5.4+ORACLE11G+WEBLOGIC10.3集群安装部署手册

    详细讲述RHEL5.4+ORACLE11G+WEBLOGIC10.3各自安装步骤和集群步骤.包括资源中心系统部署结构,整体部署方案,性能调优建议三大部分,图文并茂,有详细步骤截图.非常适合初学者学习,也适合有一经验的工作者作为技术参考...

    Liunx 下 nginx+tomcat 集群建设

    在Linux系统上,安装Nginx和Tomcat相对简单。首先,通过包管理器如apt-get(Debian/Ubuntu)或yum(CentOS/RHEL)安装这两个软件。安装完成后,配置Nginx的代理设置,使其指向Tomcat服务器。在Nginx的配置文件(通常...

    RHEL5.5+Drbd+Heartbeat+Oracle10R2架构详解

    Drbd、Heartbeat 文件版本及简介: Cluster-Resource-Agents-agents-1.0.3.tar.bz2 Reusable-Cluster-Components-glue-1.0.6.tar.bz2 Heartbeat-3-0-STABLE-3.0.3.tar.bz2 Pacemaker-1-0-Pacemaker-1.0.9.tar.bz2 ...

    RHEL 5.X 64bit+oracle 11g安装手册

    本文档详细介绍了如何在 RHEL 5.5 x64 系统上安装 Oracle 11g 数据库的过程,包括前期的系统准备、环境配置、用户与组的创建以及依赖包的安装等关键步骤。遵循这些步骤可以有效地完成 Oracle 数据库的安装,并为后续...

    RHEL5+ORACLE11G+WEBLOGIC+JDK终极教程

    在安装Oracle之前,还需满足特定的系统要求,例如检查内核版本、调整内核参数、创建所需的用户和组,以及设置适当的文件权限。 一旦系统准备就绪,可以开始Oracle数据库的安装。这通常涉及创建数据库实例、配置监听...

    RHEL-5.7+DRBD+heartbeat+Oracle10R2双机安装实例.doc

    RHEL-5.7+DRBD+heartbeat+Oracle10R2双机安装实例.doc

    RHEL5+PXE+NFS+Kickstart

    RHEL5+PXE+NFS+Kickstart

Global site tag (gtag.js) - Google Analytics