`
zhanghong_bean
  • 浏览: 2514 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

用rvm安装rails 3.0

 
阅读更多
系统:ubuntu
当前RoR版本

zhanghong@zh-desktop:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

zhanghong@zh-desktop:~$ rails -v
Rails 2.3.5

1安装rvm
mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm && ./install

修改.bashrc,在文件末行添加
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm

查看rvm版本,新打开一个终端
zhanghong@zh-desktop:~$ rvm -v

rvm 0.1.38 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

更新rvm
rvm update --head

install curl
sudo apt-get install curl libcurl3 libcurl3-dev


install ruby 1.9.1
zhanghong@zh-desktop:~$ rvm install 1.9.1
................
zhanghong@zh-desktop:~$ rvm list

rvm rubies

   ruby-1.9.1-p378 [ i386 ]

查看ruby版本
zhanghong@zh-desktop:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
zhanghong@zh-desktop:~$ rvm 1.9.1
zhanghong@zh-desktop:~$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]


安装gem
gem会安装到/home/zhanghong/.rvm/gems/ruby-1.9.1-p378,查看gem安装地址方法
rvm gemdir

gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
gem install rails --pre

zhanghong@zh-desktop:~$ rails -v
Rails 3.0.0.beta4
#创建项目
zhanghong@zh-desktop:~/workspace$ rails new  topscore -d mysql


启动项目
zhanghong@zh-desktop:~/workspace/topscore$ rails start
Could not find gem 'mysql (>= 0, runtime)' in the gems available on this machine.
Try running `bundle install`.
zhanghong@zh-desktop:~/workspace/topscore$ bundle install mysql
Fetching source index from http://rubygems.org/
Using rake (0.8.7) from system gems 
Using abstract (1.0.0) from system gems 
Using activesupport (3.0.0.beta4) from system gems 
Using builder (2.1.2) from system gems 
Using i18n (0.4.1) from system gems 
Using activemodel (3.0.0.beta4) from system gems 
Using erubis (2.6.5) from system gems 
Using rack (1.1.0) from system gems 
Using rack-mount (0.6.3) from system gems 
Using rack-test (0.5.4) from system gems 
Using tzinfo (0.3.22) from system gems 
Using actionpack (3.0.0.beta4) from system gems 
Using mime-types (1.16) from system gems 
Using polyglot (0.3.1) from system gems 
Using treetop (1.4.8) from system gems 
Using mail (2.2.3) from system gems 
Using actionmailer (3.0.0.beta4) from system gems 
Using arel (0.4.0) from system gems 
Using activerecord (3.0.0.beta4) from system gems 
Using activeresource (3.0.0.beta4) from system gems 
Using bundler (0.9.26) from system gems 
Installing mysql (2.8.1) from rubygems repository at http://rubygems.org/ with native extensions 
Using thor (0.13.6) from system gems 
Using railties (3.0.0.beta4) from system gems 
Using rails (3.0.0.beta4) from system gems 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

zhanghong@zh-desktop:~/workspace/topscore$ bundle show
Gems included by the bundle:
  * abstract (1.0.0)
  * actionmailer (3.0.0.beta4)
  * actionpack (3.0.0.beta4)
  * activemodel (3.0.0.beta4)
  * activerecord (3.0.0.beta4)
  * activeresource (3.0.0.beta4)
  * activesupport (3.0.0.beta4)
  * arel (0.4.0)
  * builder (2.1.2)
  * bundler (0.9.26)
  * erubis (2.6.5)
  * i18n (0.4.1)
  * mail (2.2.3)
  * mime-types (1.16)
  * mysql (2.8.1)
  * polyglot (0.3.1)
  * rack (1.1.0)
  * rack-mount (0.6.3)
  * rack-test (0.5.4)
  * rails (3.0.0.beta4)
  * railties (3.0.0.beta4)
  * rake (0.8.7)
  * thor (0.13.6)
  * treetop (1.4.8)
  * tzinfo (0.3.22)

zhanghong@zh-desktop:~/workspace/topscore$ rails server
=> Booting WEBrick
=> Rails 3.0.0.beta4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-06-09 17:37:41] INFO  WEBrick 1.3.1
[2010-06-09 17:37:41] INFO  ruby 1.8.7 (2009-06-12) [i686-linux]
[2010-06-09 17:37:46] INFO  WEBrick::HTTPServer#start: pid=6283 port=3000


切换到系统原来ruby
zhanghong@zh-desktop:~$ rvm list

rvm rubies

=> ruby-1.9.1-p378 [ i386 ]

zhanghong@zh-desktop:~$ rvm system
zhanghong@zh-desktop:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

参考url
http://asciicasts.com/episodes/200-rails-3-beta-and-rvm
分享到:
评论

相关推荐

    RVM安装和使用总结笔记

    RVM安装完成后,无需使用sudo来运行RVM或gem命令。 **二、Ruby的安装与管理** 通过RVM,你可以轻松安装和管理多个Ruby版本。例如,安装Ruby 1.8.7的最新版本并生成文档,可以使用: ```bash rvm install ruby-...

    solos:Solos-Rails 6 Ruby 3

    安装Ruby 3.0.0 rvm install ruby-3.0.03.将Ruby 3.0.0设置为默认的ruby版本rvm use 3.0.0 --default4.安装Rails 6.1.3 gem install rails -v 6.1.35.安装postgresql和各种库sudo apt install postgresql libpq-dev ...

    redmine搭建手册(完整版)

    - Ruby官方文档:了解Ruby的安装和使用。 - Rails官方文档:学习Rails的框架特性。 - MySQL文档:关于数据库的配置和管理。 - Apache文档:配置Apache以支持Redmine。 1.3. 安装环境 确保你的系统满足以下最低要求...

    SHARIAsource

    SHARIA来源设定步骤使用rvm安装Ruby版本在指定Gemfile 。 bundle install 。 将config/database.example.yml复制到config/database.yml并填写相应的字段。 将config/secrets.example.yml复制到config/secrets.yml...

    calblueprint.org:蓝图网站和应用程序门户

    安装和RVM(如果在Mac上) 转到代码库文件夹,切换到ruby 2.6.5: rvm use 2.5.6 (每次在此文件夹中打开终端时都必须执行此操作) 在本地安装Postgresql,在mac brew install postgresql 。 (如果出现错误,请...

    ruby-3.0.2.tar.gz

    在实际项目中,推荐使用版本管理工具如RVM(Ruby Version Manager)或rbenv,它们可以帮助轻松切换不同版本的Ruby,方便管理和维护多个项目的需求。 总的来说,Ruby 3.0.2是一个重要的更新,它不仅带来了性能的提升...

Global site tag (gtag.js) - Google Analytics