簡體   English   中英

使用capistrano在EC2 Amazon Unix上安裝ruby

[英]installing ruby on EC2 Amazon Unix, using capistrano

我試圖再次使用capistrano安裝ruby 1.9.3-p545。 一年前對我有用的東西似乎被rvm破壞了:

require "rvm/capistrano"

set :rvm_ruby_string, 'ruby-1.9.3-p327'
set :rvm_type, :user
set :rvm_install_ruby_params, '--with-opensll-dir=$HOME/.rvm/usr'

def rvm_bin
    '$HOME/.rvm/bin/rvm'
end

namespace :deploy do
    task :step do
        rvm.install_rvm
        run "#{rvm_bin} autolibs enable"
        rvm.install_ruby
        run "#{rvm_bin} alias create default #{rvm_ruby_string}"
        run 'echo "source ~/.rvm/environments/default" >> $HOME/.bashrc'
        run 'which ruby && ruby -v'
        run 'gem install --no-ri --no-rdoc rake rack net-ssh bundler'
    end
end

看起來rvm autolibs enable不再起作用,因為我收到以下錯誤消息:

Checking requirements for amazon.
Missing required packages: libyaml-devel libffi-devel readline-devel openssl-devel bison
RVM autolibs is now configured with mode '2' => 'check and stop if missing',
please run `rvm autolibs enable` to let RVM do its job or run and read `rvm autolibs [help]`

我認為肯定有其他人使用capistrano安裝紅寶石。 我嘗試從源代碼安裝ruby,但是隨后遇到了缺少Yaml支持的問題。

有什么想法,指針嗎?

因此,這是我沒有rmv的解決方案。 如果您有任何改進,想法或批評,請告訴我:

namespace :deploy do
    RUBY_VERSION = 'ruby-1.9.3-p545'

    task :step do
        # remove default ruby and install dependencies     
        run "#{sudo} yum erase --assumeyes ruby"
        run "#{sudo} yum install --assumeyes readline-devel openssl-devel libyaml-devel"
        # Add the installed ruby to PATH
        run "echo 'export PATH=$PATH:$HOME/bin' >> $HOME/.bashrc"
        run "source $HOME/.bashrc"
        # Build and install
        run "wget http://cache.ruby-lang.org/pub/ruby/1.9/#{RUBY_VERSION}.tar.gz"
        run "tar zxvf #{RUBY_VERSION}.tar.gz"
        run "cd #{RUBY_VERSION} && ./configure --disable-install-doc --enable-shared --prefix=$HOME && make && make install"
        # Check installation and install very basic gems
        run 'which ruby && ruby -v'
        run "gem install --no-ri --no-rdoc rake rack net-ssh bundler"
    end
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM