免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5564 | 回复: 1
打印 上一主题 下一主题

Ubuntu下使用RVM 安装Rails [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-12 21:20 |只看该作者 |倒序浏览

Ubuntu下使用RVM 安装Rails










使用Ubuntu版本:11.04
1.安装RVM



Java代码
  1. 1.bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)  
复制代码
2.安装Ruby
RVM安装完成后可以使用


Java代码
  1. 1.rvm requirements  
  2. 命令查看安装可选项。
  3. 执行rvm install 1.9.2
复制代码
Java代码
  1. 1.ubuntu:~$ rvm install 1.9.2  
  2. 2.Fetching yaml-0.1.4.tar.gz to /home/wenpeng/.rvm/archives  
  3. 3.  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
  4. 4.                                 Dload  Upload   Total   Spent    Left  Speed  
  5. 5.100  460k  100  460k    0     0  51442      0  0:00:09  0:00:09 --:--:-- 63694  
  6. 6.Extracting yaml-0.1.4.tar.gz to /home/wenpeng/.rvm/src  
  7. 7.Configuring yaml in /home/wenpeng/.rvm/src/yaml-0.1.4.  
  8. 8.Compiling yaml in /home/wenpeng/.rvm/src/yaml-0.1.4.  
  9. 9.Installing yaml to /home/wenpeng/.rvm/usr  
  10. 10.Installing Ruby from source to: /home/wenpeng/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...  
  11. 11.  
  12. 12.ruby-1.9.2-p290 - #fetching   
  13. 13.ruby-1.9.2-p290 - #downloading ruby-1.9.2-p290, this may take a while depending on your connection...  
  14. 14.  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
  15. 15.                                 Dload  Upload   Total   Spent    Left  Speed  
  16. 16.100 8604k  100 8604k    0     0  24844      0  0:05:54  0:05:54 --:--:-- 30418  
  17. 17.ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /home/wenpeng/.rvm/src/ruby-1.9.2-p290  
  18. 18.ruby-1.9.2-p290 - #extracted to /home/wenpeng/.rvm/src/ruby-1.9.2-p290  
  19. 19.ruby-1.9.2-p290 - #configuring   
  20. 20.ruby-1.9.2-p290 - #compiling   
  21. 21.ruby-1.9.2-p290 - #installing   
  22. 22.Retrieving rubygems-1.8.17  
  23. 23.  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
  24. 24.                                 Dload  Upload   Total   Spent    Left  Speed  
  25. 25.100  246k  100  246k    0     0  50303      0  0:00:05  0:00:05 --:--:-- 60119  
  26. 26.Extracting rubygems-1.8.17 ...  
  27. 27.Removing old Rubygems files...  
  28. 28.Installing rubygems-1.8.17 for ruby-1.9.2-p290 ...  
  29. 29.Installation of rubygems completed successfully.  
  30. 30.ruby-1.9.2-p290 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).  
  31. 31.ruby-1.9.2-p290 - #importing default gemsets (/home/wenpeng/.rvm/gemsets/)  
  32. 32.Install of ruby-1.9.2-p290 - #complete   
复制代码
设置1.9.2 作为默认的Ruby版本



Java代码
  1. 1.rvm use 1.9.2 --default  
复制代码
报错提示



Java代码
  1. 1.RVM is not a function, selecting rubies with 'rvm use ...' will not work.  
复制代码
解决方法
执行


Java代码
  1. 1.echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile  
复制代码
然后重启Terminer再执行


Java代码
  1. 1.source .bash_profile  
复制代码
这里还可以直接把这段命令写进/etc/profile



Java代码
  1. 1.ubuntu:~$ rvm use 1.9.2 --default  
  2. 2.Using /home/wenpeng/.rvm/gems/ruby-1.9.2-p290  
复制代码
安装rails 需要的lib




Java代码
  1. 1.sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion  
  2. 2.  
  3. 3.sudo apt-get install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev   
复制代码
Java代码
  1. 1.gem install rails   
复制代码
如果出现问题的话需要remove掉ruby然后重新安装



Java代码
  1. 1.rvm remove ruby  
  2. 2.rvm install 1.9.2  
  3. 3.rvm use 1.9.3 --default  
  4. 4.gem install rails   
复制代码
如果在启动rails server的过程中提示No JavaScripts Run time 有两个解决方法
解决方法1:
  1. Adding the following gems to my Gemfile solved the issue:

  2. gem 'execjs'
  3. gem 'therubyracer'

  4. Then of course:
复制代码
这里需要先bundle install therubyracer
然后bundle install



解决方法2:

安装nodejs

lijg@lijg-desktop:~/workruby/helloapp$ sudo apt-cache search nodejs
[sudo] password for lijg:
coffeescript - interpreter and compiler for the CoffeeScript language
nodejs - Node.js event-based server-side javascript engine
nodejs-dbg - Node.js event-based server-side javascript engine (debug)

nodejs-dev - Development files for Node.js

论坛徽章:
0
2 [报告]
发表于 2012-03-12 21:21 |只看该作者
谢谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP