Ubuntu下使用RVM 安装Rails

[b]使用Ubuntu版本:11.04[/b]
[b]1.安装RVM[/b]
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

[b]2.安装Ruby[/b]
RVM安装完成后可以使用
rvm requirements
命令查看安装可选项。
执行rvm install 1.9.2

ubuntu:~$ rvm install 1.9.2
Fetching yaml-0.1.4.tar.gz to /home/wenpeng/.rvm/archives
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 460k 100 460k 0 0 51442 0 0:00:09 0:00:09 --:--:-- 63694
Extracting yaml-0.1.4.tar.gz to /home/wenpeng/.rvm/src
Configuring yaml in /home/wenpeng/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/wenpeng/.rvm/src/yaml-0.1.4.
Installing yaml to /home/wenpeng/.rvm/usr
Installing Ruby from source to: /home/wenpeng/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...

ruby-1.9.2-p290 - #fetching
ruby-1.9.2-p290 - #downloading ruby-1.9.2-p290, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8604k 100 8604k 0 0 24844 0 0:05:54 0:05:54 --:--:-- 30418
ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /home/wenpeng/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #extracted to /home/wenpeng/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #configuring
ruby-1.9.2-p290 - #compiling
ruby-1.9.2-p290 - #installing
Retrieving rubygems-1.8.17
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 246k 100 246k 0 0 50303 0 0:00:05 0:00:05 --:--:-- 60119
Extracting rubygems-1.8.17 ...
Removing old Rubygems files...
Installing rubygems-1.8.17 for ruby-1.9.2-p290 ...
Installation of rubygems completed successfully.
ruby-1.9.2-p290 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.2-p290 - #importing default gemsets (/home/wenpeng/.rvm/gemsets/)
Install of ruby-1.9.2-p290 - #complete

[b]设置1.9.2 作为默认的Ruby版本[/b]
[code]rvm use 1.9.2 --default[/code]
[b]报错提示[/b]
[code]RVM is not a function, selecting rubies with 'rvm use ...' will not work.[/code]
解决方法
执行
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
然后重启Terminer再执行
source .bash_profile
这里还可以直接把这段命令写进/etc/profile
ubuntu:~$ rvm use 1.9.2 --default
Using /home/wenpeng/.rvm/gems/ruby-1.9.2-p290


安装rails 需要的lib

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

sudo apt-get install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev


gem install rails 

如果出现问题的话需要remove掉ruby然后重新安装
rvm remove ruby
rvm install 1.9.2
rvm use 1.9.3 --default
gem install rails


如果在启动rails server的过程中提示No JavaScripts Run time 有两个解决方法
解决方法1:

Adding the following gems to my Gemfile solved the issue:

gem 'execjs'
gem 'therubyracer'

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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值