Deploy Rails with Ruby1.9.2 on Redhat4(1)

Deploy Rails with Ruby1.9.2 on Redhat4(1)

1. Install gcc
check the version of gcc on my system.
>gcc -v
I already had it.

2. Install ruby
from the URL http://www.ruby-lang.org/en/downloads, I download the file ruby-1.9.2-p290.tar.gz
>tar zxvf ruby-1.9.2-p290.tar.gz
>cd ruby-1.9.2-p290/
>./configure --prefix=/usr/local/ruby1.9.2
>make
>sudo make install
error messages says : carl is not in the sudoers file.  This incident will be reported.
solutions:
I need to make user carl sudoers.
>/usr/sbin/visudo -f /etc/sudoers
# User privilege specification
root    ALL=(ALL) ALL
carl    ALL=(ALL) ALL

>sudo make install

add the bin directory to PATH
>su root
>vi /etc/profile
PATH=$PATH:/sbin:/usr/sbin:/usr/local/ruby1.9.2/bin
export PATH
>. /etc/profile
>ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

3. download and install rubygems
from this URL http://rubyforge.org/projects/rubygems/ , I got the file as follow rubygems-1.8.8.tgz
>tar zxvf rubygems-1.8.8.tgz
>cd rubygems-1.8.8/
>sudo ruby setup.rb

4. Install rails
>sudo gem install rails --pre --no-ri --no-rdoc
>rails -v
Rails 3.1.0.rc6
>sudo gem uninstall rails -v=3.1.0.rc6
>sudo gem install rails --pre --no-ri --no-rdoc -v=3.1.0.rc5
>rails -v
Rails 3.1.0.rc5

5. Install passenger
download the file from this URL http://files.rubyforge.vm.bytemark.co.uk/passenger/passenger-3.0.8.tar.gz
>tar xzvf passenger-3.0.8.tar.gz
>mkdir ../tools
>mv passenger-3.0.8/ ../tools/
>cd ../tools/passenger-3.0.8/

put the passenger/bin directory to PATH
>vi /etc/profile
PATH=$PATH:/sbin:/usr/sbin:/usr/local/ruby1.9.2/bin:/home/carl/tools/passenger-3.0.8/bin
>. /etc/profile
>bin/passenger-install-apache2-module

It asks me to install some softwares:
>sudo yum install httpd-devel
>sudo yum install apr-devel
>sudo yum install apr-util-devel

>sudo gem install mysql2 or >bundle install
error messages:
/usr/local/ruby1.9.2/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.

solutions:
>sudo yum groupinstall "Development Tools"
>sudo yum install ruby-devel
This is not the right solution. I need to install dev-kit. Install the git first, add git to respository
>sudo rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
>sudo yum install git
Installing git is not success.

>wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.gz
>tar zxvf git-1.7.6.tar.gz
>cd git-1.7.6
>./configure --prefix=/usr/local/git
>make
>sudo make install
>git -v

>git clone git://github.com/oneclick/rubyinstaller.git
>cd rubyinstaller
>rake devkit sfx=1
Not success.

>sudo yum install mysql-devel
>sudo yum install sqlite sqlite-devel
>sudo gem install sqlite3-ruby

error messages:
database.c: In function `initialize':
database.c:47: error: `SQLITE_OPEN_READWRITE' undeclared (first use in this function)
database.c:47: error: (Each undeclared identifier is reported only once
database.c:47: error: for each function it appears in.)

solutions:
>sudo gem install sqlite3-ruby -v=1.2.5

No, it is not helpful.

>wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
>tar zxvf sqlite-autoconf-3070701.tar.gz
>cd sqlite-autoconf-3070701
>sudo ./configure --prefix=/usr/tool/sqlite
>sudo make
>sudo make install
>cd /usr/tool/sqlite/bin
>sqlite3 -version
3.3.6

change the Gemfile content to
gem 'sqlite3', '1.2.5'

No way out, just comments the line of sqlite3 in Gemfile.

>rails server
error message:
/usr/local/ruby1.9.2/lib/ruby/gems/1.9.1/gems/execjs-1.2.4/lib/execjs/runtimes.rb:45:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

>sudo gem install rake
>sudo gem install rack
>sudo gem install fastthread
>sudo gem install execjs
>sudo gem install therubyracer
>sudo gem install --no-ri --no-rdoc therubyracer
>sudo gem install libv8
###>gem install johnson
>sudo gem install daemon_controller
>sudo gem install pcre-devel

try to go with passenger >passenger start
error messages:
error: unrecognized command line option "-Wno-missing-field-initializers"
solutions:
upgrade gcc on redhat4
>wget http://ftp.gnu.org/pub/pub/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2
>tar jxf gcc-4.2.0.tar.bz2
>sudo mkdir /usr/gcc4
>cd gcc-4.2.0
>./configure --prefix=/usr/gcc4
>make clean
>make
>make check
>sudo make install
>sudo mv /usr/bin/gcc /usr/bin/gcc.bak
>sudo ln -sv /usr/gcc4/bin/gcc /usr/bin/gcc
>sudo mv /usr/bin/cpp /usr/bin/cpp3
>sudo mv /usr/bin/g++ /usr/bin/g++.bak
>sudo ln -s /usr/gcc4/bin/g++ /usr/bin/g++
>sudo mv /usr/bin/gcov /usr/bin/gcov.bak
>sudo ln -s /usr/gcc4/bin/gcov /usr/bin/gcov
>sudo mv /usr/bin/c++ /usr/bin/c++.bak
>sudo ln -s /usr/gcc4/bin/c++ /usr/bin/c++
>sudo mv /usr/bin/cpp /usr/bin/cpp.bak
>sudo ln -s /usr/gcc4/bin/cpp /usr/bin/cpp

error messages:
Could not start Passenger Nginx core:
/home/carl/.passenger/standalone/3.0.8-x86-ruby1.9.2-linux-gcc3.4.6-1002/nginx-1
.0.5/sbin/nginx: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found
(required by
solutions:
>sudo mv /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6.bak
>sudo ln -s /usr/gcc4/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6
It works.

update the yum and install curl
>sudo yum update
>sudo yum install curl curl-devel

try to install rvm
###>bash < <(curl -sk https://rvm.beginrescueend.com/install/rvm)
###>echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
###>source ~/.bash_profile
>curl -k https://rvm.beginrescueend.com/install/rvm -o rvm-installer
>chmod +x rvm-installer
>rvm_bin_path=~/.rvm/bin rvm_man_path=~/.rvm/share/man ./rvm-installer

It is not working for me to install rvm on redhat4.

>vi Gemfile
gem 'therubyracer', '>= 0.8.2'
gem 'therubyracer-heroku'
>bundle exec rake -T

>git clone https://github.com/fractaloop/libv8.git

messages:
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/fractaloop/libv8.git/info/refs

>env GIT_SSL_NO_VERIFY=true git clone https://github.com/fractaloop/libv8.git
>cd libv8
>env GIT_SSL_NO_VERIFY=true git submodule update --init
>bundle install
>bundle exec rake compile

Finally, I can not run >passenger start and >rails server on my virtualbox redhat4 machine. I will try the rails_mod next.
Other problems are solved, all of the 2 command report this kind of error message at the end.
[ pid=2900 thr=82891570 file=utils.rb:176 time=2011-08-21 11:57:44.100 ]: *** Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)) (process 2900, thread #<Thread:0x9e1a664>):

references:
http://sillycat.iteye.com/blog/562613
http://sillycat.iteye.com/blog/562615
http://sillycat.iteye.com/blog/562617
http://sillycat.iteye.com/blog/562618
http://www.modrails.com/install.html
http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
http://www.freshblurbs.com/installing-ruby-rails-3-centos-nginx
http://hi.baidu.com/addcn/blog/item/eac5c094e5a22b43d0135e84.html
http://railsapps.github.com/installing-rails-3-1.html
http://wuhuizhong.iteye.com/blog/1106968

你可能感兴趣的:(C++,Ruby,Rails)