Deploy Rails with Ruby1.9.2 on Redhat4(1)
DeployRailswithRuby1.9.2onRedhat4(1)
1.Installgcc
checktheversionofgcconmysystem.
>gcc-v
Ialreadyhadit.
2.Installruby
fromtheURLhttp://www.ruby-lang.org/en/downloads,Idownloadthefileruby-1.9.2-p290.tar.gz
>tarzxvfruby-1.9.2-p290.tar.gz
>cdruby-1.9.2-p290/
>./configure--prefix=/usr/local/ruby1.9.2
>make
>sudomakeinstall
errormessagessays:carlisnotinthesudoersfile.Thisincidentwillbereported.
solutions:
Ineedtomakeusercarlsudoers.
>/usr/sbin/visudo-f/etc/sudoers
#Userprivilegespecification
rootALL=(ALL)ALL
carlALL=(ALL)ALL
>sudomakeinstall
addthebindirectorytoPATH
>suroot
>vi/etc/profile
PATH=$PATH:/sbin:/usr/sbin:/usr/local/ruby1.9.2/bin
exportPATH
>./etc/profile
>ruby-v
ruby1.9.2p290(2011-07-09revision32553)[i686-linux]
3.downloadandinstallrubygems
fromthisURLhttp://rubyforge.org/projects/rubygems/,Igotthefileasfollowrubygems-1.8.8.tgz
>tarzxvfrubygems-1.8.8.tgz
>cdrubygems-1.8.8/
>sudorubysetup.rb
4.Installrails
>sudogeminstallrails--pre--no-ri--no-rdoc
>rails-v
Rails3.1.0.rc6
>sudogemuninstallrails-v=3.1.0.rc6
>sudogeminstallrails--pre--no-ri--no-rdoc-v=3.1.0.rc5
>rails-v
Rails3.1.0.rc5
5.Installpassenger
downloadthefilefromthisURLhttp://files.rubyforge.vm.bytemark.co.uk/passenger/passenger-3.0.8.tar.gz
>tarxzvfpassenger-3.0.8.tar.gz
>mkdir../tools
>mvpassenger-3.0.8/../tools/
>cd../tools/passenger-3.0.8/
putthepassenger/bindirectorytoPATH
>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
Itasksmetoinstallsomesoftwares:
>sudoyuminstallhttpd-devel
>sudoyuminstallapr-devel
>sudoyuminstallapr-util-devel
>sudogeminstallmysql2or>bundleinstall
errormessages:
/usr/local/ruby1.9.2/lib/ruby/1.9.1/mkmf.rb:368:in`try_do':Thecomplierfailedtogenerateanexecutablefile.(RuntimeError)
Youhavetoinstalldevelopmenttoolsfirst.
solutions:
>sudoyumgroupinstall"DevelopmentTools"
>sudoyuminstallruby-devel
Thisisnottherightsolution.Ineedtoinstalldev-kit.Installthegitfirst,addgittorespository
>sudorpm-Uhvhttp://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
>sudoyuminstallgit
Installinggitisnotsuccess.
>wgethttp://kernel.org/pub/software/scm/git/git-1.7.6.tar.gz
>tarzxvfgit-1.7.6.tar.gz
>cdgit-1.7.6
>./configure--prefix=/usr/local/git
>make
>sudomakeinstall
>git-v
>gitclonegit://github.com/oneclick/rubyinstaller.git
>cdrubyinstaller
>rakedevkitsfx=1
Notsuccess.
>sudoyuminstallmysql-devel
>sudoyuminstallsqlitesqlite-devel
>sudogeminstallsqlite3-ruby
errormessages:
database.c:Infunction`initialize':
database.c:47:error:`SQLITE_OPEN_READWRITE'undeclared(firstuseinthisfunction)
database.c:47:error:(Eachundeclaredidentifierisreportedonlyonce
database.c:47:error:foreachfunctionitappearsin.)
solutions:
>sudogeminstallsqlite3-ruby-v=1.2.5
No,itisnothelpful.
>wgethttp://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
>tarzxvfsqlite-autoconf-3070701.tar.gz
>cdsqlite-autoconf-3070701
>sudo./configure--prefix=/usr/tool/sqlite
>sudomake
>sudomakeinstall
>cd/usr/tool/sqlite/bin
>sqlite3-version
3.3.6
changetheGemfilecontentto
gem'sqlite3','1.2.5'
Nowayout,justcommentsthelineofsqlite3inGemfile.
>railsserver
errormessage:
/usr/local/ruby1.9.2/lib/ruby/gems/1.9.1/gems/execjs-1.2.4/lib/execjs/runtimes.rb:45:in`autodetect':CouldnotfindaJavaScriptruntime.Seehttps://github.com/sstephenson/execjsforalistofavailableruntimes.(ExecJS::RuntimeUnavailable)
>sudogeminstallrake
>sudogeminstallrack
>sudogeminstallfastthread
>sudogeminstallexecjs
>sudogeminstalltherubyracer
>sudogeminstall--no-ri--no-rdoctherubyracer
>sudogeminstalllibv8
###>geminstalljohnson
>sudogeminstalldaemon_controller
>sudogeminstallpcre-devel
trytogowithpassenger>passengerstart
errormessages:
error:unrecognizedcommandlineoption"-Wno-missing-field-initializers"
solutions:
upgradegcconredhat4
>wgethttp://ftp.gnu.org/pub/pub/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2
>tarjxfgcc-4.2.0.tar.bz2
>sudomkdir/usr/gcc4
>cdgcc-4.2.0
>./configure--prefix=/usr/gcc4
>makeclean
>make
>makecheck
>sudomakeinstall
>sudomv/usr/bin/gcc/usr/bin/gcc.bak
>sudoln-sv/usr/gcc4/bin/gcc/usr/bin/gcc
>sudomv/usr/bin/cpp/usr/bin/cpp3
>sudomv/usr/bin/g++/usr/bin/g++.bak
>sudoln-s/usr/gcc4/bin/g++/usr/bin/g++
>sudomv/usr/bin/gcov/usr/bin/gcov.bak
>sudoln-s/usr/gcc4/bin/gcov/usr/bin/gcov
>sudomv/usr/bin/c++/usr/bin/c++.bak
>sudoln-s/usr/gcc4/bin/c++/usr/bin/c++
>sudomv/usr/bin/cpp/usr/bin/cpp.bak
>sudoln-s/usr/gcc4/bin/cpp/usr/bin/cpp
errormessages:
CouldnotstartPassengerNginxcore:
/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'notfound
(requiredby
solutions:
>sudomv/usr/lib/libstdc++.so.6/usr/lib/libstdc++.so.6.bak
>sudoln-s/usr/gcc4/lib/libstdc++.so.6/usr/lib/libstdc++.so.6
Itworks.
updatetheyumandinstallcurl
>sudoyumupdate
>sudoyuminstallcurlcurl-devel
trytoinstallrvm
###>bash<<(curl-skhttps://rvm.beginrescueend.com/install/rvm)
###>echo'[[-s"$HOME/.rvm/scripts/rvm"]]&&."$HOME/.rvm/scripts/rvm"#LoadRVMfunction'>>~/.bash_profile
###>source~/.bash_profile
>curl-khttps://rvm.beginrescueend.com/install/rvm-orvm-installer
>chmod+xrvm-installer
>rvm_bin_path=~/.rvm/binrvm_man_path=~/.rvm/share/man./rvm-installer
Itisnotworkingformetoinstallrvmonredhat4.
>viGemfile
gem'therubyracer','>=0.8.2'
gem'therubyracer-heroku'
>bundleexecrake-T
>gitclonehttps://github.com/fractaloop/libv8.git
messages:
error:SSLcertificateproblem,verifythattheCAcertisOK.Details:
error:14090086:SSLroutines:SSL3_GET_SERVER_CERTIFICATE:certificateverifyfailedwhileaccessinghttps://github.com/fractaloop/libv8.git/info/refs
>envGIT_SSL_NO_VERIFY=truegitclonehttps://github.com/fractaloop/libv8.git
>cdlibv8
>envGIT_SSL_NO_VERIFY=truegitsubmoduleupdate--init
>bundleinstall
>bundleexecrakecompile
Finally,Icannotrun>passengerstartand>railsserveronmyvirtualboxredhat4machine.Iwilltrytherails_modnext.
Otherproblemsaresolved,allofthe2commandreportthiskindoferrormessageattheend.
[pid=2900thr=82891570file=utils.rb:176time=2011-08-2111:57:44.100]:***ExceptionPhusionPassenger::UnknownErrorinPhusionPassenger::Rack::ApplicationSpawner(CouldnotfindaJavaScriptruntime.Seehttps://github.com/sstephenson/execjsforalistofavailableruntimes.(ExecJS::RuntimeUnavailable))(process2900,thread#<Thread:0x9e1a664>):
references:
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