升级Turnkey Rails虚拟机到最新Rails版本

 

 参考资料:

http://www.turnkeylinux.org/forum/support/20110826/how-upgrade-turnkey-rails-rails-301

https://rvm.beginrescueend.com/rvm/install/

 

具体步骤如下:

1.选择用root来安装

2.安装curl

# Install curl. It's needed to install rvm the easy way. Ignore the error about the java .so:
  apt-get install curl
3. 安装rvm

# Install rvm:(这里bash后面是一个空格,然后<,再一个空格)
  bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)


4. 安装在RVM下Ruby1.9.2

# Install 1.9.2 under rvm:
  rvm install ruby-1.9.2

5. 指定使用1.9.2
# Make it the default:
  rvm use ruby-1.9.2 --default
# Change to it (although the --default line probably does this):
  rvm use ruby-1.9.2-p(patchlevel)

6. 创建gemset
# Gemset for Rails 3:
  rvm gemset create rails3
# Use that gemset:
  rvm gemset use rails3
# (Re-) Install Rails:
  gem install rails
(具体安装版本3.1.0, 会看到一些unable to covert和file 'lib'  not found, 可以忽略)

  rails -v 可以看到安装的rails版本

7. 安装Passenger(RoR的部署技术)

# (Re-) Install Passenger:
  gem install passenger
# Install the necessary prerequisite library:
  apt-get install libcurl4-openssl-dev
 
Compile and install the Passenger module. First you have to find the version of Passenger that you just installed (which is in a different place from the one preinstalled in the appliance):
  find /usr/local/rvm -name passenger-install-apache2-module
 
Two paths will appear, one of them in bin and the other one in gems. Take the shorter one and copy it. For my system, the two paths were:
  /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin/passenger-install-apache2-module
  and
  /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/gems/passenger-3.0.8/bin/passenger-install-apache2-module
 
Run that script:
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin/passenger-install-apache2-module
 
IMPORTANT: Grab the configuration lines at the end of the passenger install process! If you just use the default Passenger LoadModule, PassengerRoot, and PassengerRuby lines the GEM_HOME and paths won't be set up correctly, and you'll run into issues like "bundler: cannot load file". For my system, those lines were:
  LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
  PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/gems/passenger-3.0.9
  PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290@rails3/ruby
 
In /etc/apache2/conf.d/passenger, replace the three corresponding lines with the new stuff you copied.
 
8. 安装Node.js (不安装Rails 3.1会报这个错误 Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable))

apt-get install python-software-properties
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

Set up your Rails application in /var/www/railsapp, do a bundle install, restart Apache (/etc/init.d/apache2 restart), and you're golden!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值