I need to install puppet 3.2.0 or greater along with ruby 2.0.0-p247 on an ubuntu 12.04 server.
Is there no way to install puppet without ruby 1.8?
Most my experience comes from CentOS so I may be missing something simple with apt.
My setup:
Make sure no ruby is present
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>
Install puppet from the official 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
The latest version of puppet is listed in 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
Installing puppet 3.3.0 brings ruby 1.8 along automatically.
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]?
puppet version
root@gitlab:/tmp/ruby-2.0.0-p247# puppet --version
3.3.0
ruby version
root@gitlab:/tmp/ruby-2.0.0-p247# ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
(note that ruby is automatically installed via update alternatives)
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
I then install ruby 2.0 into it's own directory, from source
./configure --prefix=/usr/bin/ruby2.0
Then register ruby 2.0 with update-alternatives
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0/bin/ruby 10
Switch to ruby 2.0 via update-alternatives
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]
I've done this several times, as long as which ruby
points to any version of ruby other than 1.8, puppet returns the following error:
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>'
How can I get puppet installed with ruby 2.0?
Puppet 3.3 is compatible with ruby 2.0 because it is listed on puppet's website
Additional resources
http://projects.puppetlabs.com/issues/18494
RVM appears to be far more complex than what I need. Also, the faq's say not to use it with sudo, or run it as root which I must do.
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
I was able to install ruby 2.0 and puppet 3.3.0 by using rvm
Install puppet
apt-get install puppet
Install rvm
\curl -L https://get.rvm.io | bash
Logout and log back in
Install ruby 2.0
rvm install ruby 2.0.0-p247
Switch to ruby 2.0
rvm use 2.0.0-p247
Check the output of
$ apt-cache depends puppet
; you might be able to useruby-1.9
, but as of 2013-09-17 at least, ruby 2.0 has not been packaged in Ubuntu.The packaged version requires ruby 1.8 or 1.9. You can use one of the not recommended methods to install it (gem, tarball), e.g.,
sudo gem install puppet
.