从CloudFormation :: Init调用多用户rvm gem安装失败
我采用了Amazon Linux AMI(基于CentOS),并以多用户方式安装了RVM(1.10.3)(请参阅下面的{1})。 我用它来安装ruby1.9.3-p125,rubygems 1.8.17和bundler 1.1作为我将要使用的实例的基本要求。 我已经将该实例捕获到AMI,现在通过CloudFormation和一些CloudFormation :: Init命令启动它。 其中之一是使用s3cmd从S3下拉一个私人gem,下一个失败的gem是安装gem。 它失败并显示一条错误消息 2012-03-15 16:53:20,201 [ERROR] Command 20_install_gems (/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/gem install ./*.gem) failed 2012-03-15 16:53:20,202 [DEBUG] Command 20_install_gems output: /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/gem:12:in `require': no such file to load — rubygems (LoadError) from /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/gem:12 现在,在cfn-init执行过程中发生这种情况 – 我假设,但还没有检查,cfn-init正在运行一个不同于ec2-user(实例上没有其他用户)的环境。 如果我在交互式会话中运行gem install mygem.gem ,那么工作正常。 所以,我的问题是,我该怎么做才能使cfn-init ? 我是否正确设置了多用户的rvm? 我已经确认cfn-init是以root用户身份运行的,在他受限制的环境下运行。 我应该如何将/etc/profile.d/rvm.sh编入根用户的会话? {1}我的半自动rvm安装步骤(以ec2用户的身份在交互式会话中运行): sudo bash -s stable […]