`
sillycat
  • 浏览: 2539043 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Rails3 and Ruby1.9.2 on Ubuntu11.04

 
阅读更多
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


分享到:
评论

相关推荐

    Ubuntu 11.04安装Ruby on rails 连接MySQL数据库.pdf

    ### Ubuntu 11.04下Ruby on Rails与MySQL数据库集成指南 #### 一、安装与配置MySQL数据库 在Ubuntu 11.04环境中,安装MySQL数据库是部署Ruby on Rails应用的重要步骤之一。首先,通过打开终端并执行以下命令进行...

    ruby-1.9.2-preview1-x64-mswin64-80.zip

    5. **Ruby开发和应用**: Ruby广泛应用于Web开发,尤其是搭配Rails框架。它也被用于系统自动化、脚本编写、数据分析等领域。1.9.2版本的更新意味着开发者可以利用新的语言特性和优化,提高代码效率和可维护性。 6. *...

    Ruby on Rails Guides v2 - Ruby on Rails 4.2.5

    ### Ruby on Rails Guides v2 - Ruby on Rails 4.2.5 #### 一、重要概念及基础假设 - **重要概念**:本指南旨在帮助读者深入理解Ruby on Rails(以下简称Rails)4.2.5版本的核心功能与最佳实践。 - **基础假设**:...

    Ruby on Rails 4.0指南:学习Ruby on Rails 4.0和Ruby 2.0的分步指南Ruby on Rails 4.0 Guide: A step by step guide to learn Ruby on Rails 4.0 and Ruby 2.0

    学习Ruby on Rails 4.0的逐步指南。 它包括针对Ruby 2.0.0的基本教程,是为至少了解另一种编程语言并熟悉HTML的程序员编写的。

    Ruby-on-Rails-rails.zip

    Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zipRuby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zip Ruby_on_Rails_rails.zipRuby_on_...

    Ruby on Rails Tutorial

    《Ruby on Rails Tutorial》中文版(原书第2版,涵盖 Rails 4) Ruby 是一门很美的计算机语言,其设计原则就是“让编程人员快乐”。David Heinemeier Hansson 就是看重了这一点,才在开发 Rails 框架时选择了 Ruby...

    ruby on rails 3

    综上所述,"Ruby on Rails 3"结合Ruby 1.9.2的特性,为开发者提供了一个强大且高效的Web开发平台,推动了Web应用的创新和发展。通过学习上述知识点,开发者可以更好地利用Rails 3构建高性能、易于维护的Web应用程序...

    ruby on rails 3 tutorial.pdf

    《Ruby on Rails 3 Tutorial》是一本专门为初学者设计的指南,旨在帮助读者快速掌握Ruby on Rails这一强大的Web开发框架。Ruby on Rails(简称Rails)是基于Ruby语言的一个开源框架,它采用MVC(Model-View-...

    ruby on rails最新版

    Ruby on Rails,简称Rails,是基于Ruby编程语言的一个开源Web应用程序框架,它遵循MVC(模型-视图-控制器)架构模式,旨在提高开发效率和代码的可读性。Rails以其“约定优于配置”(Convention over Configuration)...

    Ruby on Rails安装包全集(Linux)

    9. **Install Ruby Rails Lighttpd MySQL on Ubuntu or FreeBSD - Huihoo Wiki - Open Source Wiki_files**: 这可能是上述文档的辅助文件,可能包含图片或其他资源,有助于理解安装过程。 安装Ruby on Rails的过程...

    ruby on rails 101

    ### Ruby on Rails 101:深入理解与实践 #### 引言 《Ruby on Rails 101》是一本介绍Ruby on Rails(简称RoR或ROR)的基础书籍,旨在为初学者提供一个全面而深入的学习框架。本书由Peter Marklund编写,包含了五天...

    Ruby on Rails_ Up and Running

    RUBY的经典之作,对其在RAILS下开发写得很详细

    ruby on rails社区网站开发源码

    Ruby on Rails,简称Rails,是由David Heinemeier Hansson创建的一个开源Web应用程序框架,它基于Ruby编程语言。这个框架以其MVC(Model-View-Controller)架构、约定优于配置(Convention over Configuration)的...

    ruby on rails 教程源码

    Ruby on Rails,简称Rails,是基于Ruby语言的开源Web应用框架,它遵循MVC(Model-View-Controller)架构模式,旨在使开发过程更加简洁高效。这个“ruby on rails 教程源码”很可能是为了辅助学习者深入理解Rails的...

    Ruby on Rails教程:学习使用Rails进行Web开发Ruby on Rails Tutorial: Learn Web Development with Rails

    本书教您如何使用Ruby on Rails开发和部署真正的,具有工业实力的Web应用程序,Ruby on Rails是为诸如Twitter,Hulu,GitHub和Yellow Pages等顶级网站提供支持的开源Web框架。

Global site tag (gtag.js) - Google Analytics