Rails3 and Ruby1.9.2 on Ubuntu11.04
1. Install ruby1.9.2
>sudo apt-get install ruby1.9.2
>cd /usr/bin
>sudo ln -s ruby1.9.1 ruby
2. Install rvm
>bash < <( curl https://rvm.beginrescueend.com/releases/rvm-install-head )
>vi /home/carl/.bashrc
change from
#[ -z "$PS1" ] && return
to
if [[ -n "$PS1" ]]; then
add these statements at the last lines:
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
fi
>source ~/.bashrc
check if the rvm is setup correctly.
>rvm notes
3. Install packages for ruby and rails
>sudo aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev subversion autoconf
I need to reinstall ruby here, because the last version installed by apt-get install ruby1.9.2 is not good maybe. I met a lot of problem when I install rails3.
>rvm install 1.9.2
set the ruby to default
>rvm --default ruby-1.9.2-p290
check the version of ruby
>ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
install rails
>sudo rm /usr/bin/gem
>sudo ln -s /usr/bin/gem1.9.1 /usr/bin/gem
>sudo gem install rdoc
>sudo gem install rails --pre --no-ri --no-rdoc
error messages:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
solution:
>sudo apt-get install ruby-dev
error messages under /usr/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-2.1.4/ext/mri :
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- mkmf (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from extconf.rb:13:in `<main>'
solution:
>sodu apt-get install ruby1.9.1-dev
great, it is work.
error messages:
>rails -v
/usr/local/lib/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [daemon_controller-0.2.6, fastthread-1.0.7, passenger-3.0.8, rack-1.3.2, rake-0.9.2, rake-0.9.2] (Gem::LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/local/lib/site_ruby/1.9.1/rubygems.rb:1200:in `gem'
from /usr/bin/rails:18:in `<main>'
solutions:
>rvmsudo gem install rails --pre --no-ri --no-rdoc
>rails -v
Lucky, it is ok now.
install passenger
>gem install -V passenger
4. Runing the passenger standalone
go to the project directory and type
>passenger start
some error about the mysql, so I solve it in this way
>bundle update mysql
>bundle install
>passenger start
I think I do not need to use rvm to install all the software, what I am doing wrong is NOT installed ruby1.9.1-dev at the first. I think with ruby1.9.2 ruby1.9.1-dev and rails3, that will work fine.
error messages:
/home/carl/.rvm/gems/ruby-1.9.2-p290/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)
from /home/carl/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.4/lib/execjs.rb:5:in `<module:ExecJS>'
solutions:
add these statements in Gemfile
>vi Gemfile
gem 'execjs'
gem 'therubyracer'
>bundle install
errror messages:
>bundle show lib8
Could not find libv8-3.3.10.2 in any of the sources
solutions:
>sudo gem install libv8
>vi Gemfile
gem 'libv8'
>bundle update
>bundle install
>rails server
It is ok now, for rails server webtrick applications.
>sudo gem install activesupport
>passenger start
It works fine now.
references:
http://www.christopherirish.com/2010/08/25/how-to-install-rvm-on-ubuntu-10-04/
http://thoughtrails.com/episodes/4-deployment-of-production-enviroment-ruby-1-9-2-rails-3-nginx-passenger-and-postgresql-with-rvm
http://armyofevilrobots.com/node/418
http://rubygems.org/gems/libv8
Rails3 and Ruby1.9.2 on Ubuntu11.04
猜你喜欢
转载自sillycat.iteye.com/blog/1153950
今日推荐
周排行