你可以安装木偶没有ruby1.8?

我需要在Ubuntu 12.04服务器上安装puppet 3.2.0或更高版本以及ruby 2.0.0-p247。

没有ruby1.8的安装木偶吗?


大多数我的经验来自CentOS,所以我可能会错过简单的apt。

我的设置:

确保没有ruby存在

root@gitlab:~# which ruby root@gitlab:~# ruby --version The program 'ruby' can be found in the following packages: * ruby1.8 * ruby1.9.1 Try: apt-get install <selected package> 

从官方ppa安装木偶

 root@gitlab:~# cat /etc/apt/sources.list.d/puppetlabs.list deb http://apt.puppetlabs.com precise main deb-src http://apt.puppetlabs.com precise main deb http://apt.puppetlabs.com precise dependencies deb-src http://apt.puppetlabs.com precise dependencies 

最新版本的puppet被列在apt中

 root@gitlab:~# apt-cache policy puppet|head puppet: Installed: (none) Candidate: 3.3.0-1puppetlabs1 Version table: 3.3.0-1puppetlabs1 0 500 http://apt.puppetlabs.com/ precise/main amd64 Packages 3.2.4-1puppetlabs1 0 500 http://apt.puppetlabs.com/ precise/main amd64 Packages 3.2.3-1puppetlabs1 0 500 http://apt.puppetlabs.com/ precise/main amd64 Packages 

安装puppet 3.3.0会自动带上ruby 1.8。

  root@gitlab:~# apt-get install puppet-common Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: augeas-lenses debconf-utils facter hiera libaugeas-ruby libaugeas-ruby1.8 libaugeas0 libjson-ruby libruby libruby1.8 libshadow-ruby1.8 ruby ruby-json ruby-rgen ruby1.8 virt-what Suggested packages: augeas-doc augeas-tools ruby-selinux libselinux-ruby1.8 librrd-ruby1.9.1 librrd-ruby1.8 ri ruby-dev ruby1.8-examples ri1.8 The following NEW packages will be installed: augeas-lenses debconf-utils facter hiera libaugeas-ruby libaugeas-ruby1.8 libaugeas0 libjson-ruby libruby libruby1.8 libshadow-ruby1.8 puppet-common ruby ruby-json ruby-rgen ruby1.8 virt-what 0 upgraded, 17 newly installed, 0 to remove and 92 not upgraded. Need to get 3,664 kB of archives. After this operation, 14.1 MB of additional disk space will be used. Do you want to continue [Y/n]? 

木偶版本

 root@gitlab:/tmp/ruby-2.0.0-p247# puppet --version 3.3.0 

ruby版本

 root@gitlab:/tmp/ruby-2.0.0-p247# ruby --version ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux] 

(注意,ruby是通过更新选项自动安装的)

 root@gitlab:/tmp/ruby-2.0.0-p247# ll `which ruby` lrwxrwxrwx 1 root root 22 Sep 18 02:57 /usr/bin/ruby -> /etc/alternatives/ruby* root@gitlab:/tmp/ruby-2.0.0-p247# update-alternatives --list ruby /usr/bin/ruby1.8 

然后我从源代码安装ruby 2.0到它自己的目录

 ./configure --prefix=/usr/bin/ruby2.0 

然后注册Ruby 2.0的更新替代品

 update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0/bin/ruby 10 

切换到ruby2.0通过更新替代品

  root@gitlab:/tmp/ruby-2.0.0-p247# update-alternatives --set ruby /usr/bin/ruby2.0/bin/ruby update-alternatives: using /usr/bin/ruby2.0/bin/ruby to provide /usr/bin/ruby (ruby) in manual mode. root@gitlab:/tmp/ruby-2.0.0-p247# ruby --version ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] 

我已经做了好几次了,只要which ruby指向除1.8以外的任何版本的ruby,puppet都会返回以下错误:

 root@gitlab:/tmp/ruby-2.0.0-p247# puppet --version /usr/bin/ruby2.0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- puppet/util/command_line (LoadError) from /usr/bin/ruby2.0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from /usr/bin/puppet:3:in `<main>' 

我怎样才能用ruby 2.0安装puppet?


Puppet 3.3与ruby 2.0兼容,因为它被列在木偶的网站上

其他资源

http://projects.puppetlabs.com/issues/18494

RVM似乎比我所需要的复杂得多。 另外,常见问题的说不要用sudo,或者以root身份运行,我必须这样做。 https://rvm.io/
http://rvm.io/support/faq

https://stackoverflow.com/questions/1892877/how-do-i-make-ruby-1-9-the-default-ruby-on-ubuntu

我能够通过使用rvm来安装ruby 2.0和puppet 3.3.0

  1. 安装木偶

    apt-get install puppet

  2. 安装rvm

    \ curl -L https://get.rvm.io | 庆典

  3. 注销并重新login

  4. 安装ruby2.0

    rvm安装ruby2.0.0-p247

  5. 切换到ruby2.0

    rvm使用2.0.0-p247

检查$ apt-cache depends puppet的输出$ apt-cache depends puppet ; 你可能可以使用ruby-1.9 ,但至less在2013-09-17, ruby 2.0还没有被打包到Ubuntu中 。

打包版本需要ruby1.8或1.9。 您可以使用不推荐的方法之一来安装它(gem,tarball),例如sudo gem install puppet