在Ubuntu上快速安装最新版本的Puppet

虽然Ubuntu的官方软件源中已经加入了Puppet,但是官方源中的Puppet版本太老,不但很多新功能没有,而且旧版本还可能有bug(比如在Puppet 2.6.4版本中的一个重大bug #6541 会在not-a-checksum MD5不对的情况下清空 file 文件【消息来源】)。结果就是我们仍然不得不手动安装Puppet。

Screenage的博主,资深Linux咨询师与系统管理员Caspar Clemens Mierau提供了两个脚本可以快速安装Puppet,大大简化了安装过程。

客户端安装:

$ bash < <(wget -qO - https://bit.ly/install-puppet-agent)

Master安装:

$ bash < <(wget -qO - https://bit.ly/install-puppet-master)

https://raw.github.com/moviepilot/puppet/master/tools/install-puppet-agent.sh

https://raw.github.com/moviepilot/puppet/master/tools/install-puppet-master.sh

不放心的朋友们可以自己检查脚本内容。

客户端安装脚本:

#!/bin/bash
if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi
# refresh package list
apt-get update
# bootstrap ruby env
apt-get -y install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev git-core

# get a working gem version and update it to the most recent one
cd /usr/local/src
wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz
tar -xzf rubygems-1.5.2.tgz
cd rubygems-1.5.2
ruby setup.rb
update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 1
gem update --system

# install puppet itself
gem install puppet --no-ri --no-rdoc

Master端安装脚本:

#!/bin/bash
if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi
# refresh package list
apt-get update
# bootstrap ruby env
apt-get -y install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev git-core

# get a working gem version and update it to the most recent one
cd /usr/local/src
wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz
tar -xzf rubygems-1.5.2.tgz
cd rubygems-1.5.2
ruby setup.rb
update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.8 1
gem update --system

# install puppet itself
gem install puppet --no-ri --no-rdoc

# we want sqlite3 and rails for stored configs on the puppet master
apt-get -y install sqlite3 libsqlite3-ruby libsqlite3-dev
gem install sqlite3-ruby --no-ri --no-rdoc
gem install rails -v 2.3.11 --no-ri --no-rdoc

相关推荐