Puppet 简明教程

Puppet - Installation

Puppet 采用客户端-服务器架构,其中我们将服务器称作 Puppet 主服务器,将客户端称作 Puppet 节点。此设置可通过在客户端和所有服务器计算机上安装 Puppet 来实现。

Puppet works on the client server architecture, wherein we call the server as the Puppet master and the client as the Puppet node. This setup is achieved by installing Puppet on both the client and well as on all the server machines.

对于大多数平台,可通过包管理器选择来安装 Puppet。然而,对于少数平台,可通过安装 tarballRubyGems 来操作。

For most of the platforms, Puppet can be installed via the package manager of choice. However, for few platforms it can be done by installing the tarball or RubyGems.

Prerequisites

Factor 是唯一一个与 Ohai 无关的先决条件, Ohai 是 Chef 中的固有要素。

Factor is the only pre-requisite that does not come along with Ohai which is present in Chef.

Standard OS Library

我们需要拥有任何底层操作系统的标准库集。所有剩余的系统都随 Ruby 1.8.2 + 版本一同提供。以下是操作系统应包含的库项目列表。

We need to have standard set of library of any underlying OS. Remaining all the system comes along with Ruby 1.8.2 + versions. Following is the list of library items, which an OS should consist of.

  1. base64

  2. cgi

  3. digest/md5

  4. etc

  5. fileutils

  6. ipaddr

  7. openssl

  8. strscan

  9. syslog

  10. uri

  11. webrick

  12. webrick/https

  13. xmlrpc

Facter Installation

如有讨论, facter 不随 Ruby 标准版本一同提供。因此,为了在目标系统中获取 facter,需要从源手动安装它,因为 facter 库是 Puppet 的先决条件。

As discussed, the facter does not come along with the standard edition of Ruby. So, in order to get the facter in the target system one needs to install it manually from the source as the facter library is a pre-requisite of Puppet.

此包面向多个平台提供,但为保险起见,它可使用 tarball 安装,后者有助于获取最新版本。

This package is available for multiple platforms however just to be on the safer side it can be installed using tarball, which helps in getting the latest version.

首先,使用 wget 实用工具从 Puppet 官方网站下载 tarball

First, download the tarball from the official site of Puppet using the wget utility.

$ wget http://puppetlabs.com/downloads/facter/facter-latest.tgz  ------: 1

下一步,将 tar 文件解压缩。使用 CD 命令进入已解压的目录。最后,使用 facter 目录中现有的 install.rb 文件安装 facter。

Next, un-tar the tar file. Get inside the untarred directory using the CD command. Finally, install the facter using install.rb file present inside the facter directory.

$ gzip -d -c facter-latest.tgz | tar xf - -----: 2
$ cd facter-* ------: 3
$ sudo ruby install.rb # or become root and run install.rb -----:4

Installing Puppet from the Source

首先,使用 wget 从 Puppet 网站安装 Puppet tar 归档。然后,将 tar 归档解压缩到目标位置。使用 CD 命令进入已创建的目录。使用 install.rb 文件,在底层服务器上安装 Puppet。

First, install the Puppet tarball from the Puppet site using wget. Then, extract the tarball to a target location. Move inside the created directory using the CD command. Using install.rb file, install Puppet on the underlying server.

# get the latest tarball
$ wget http://puppetlabs.com/downloads/puppet/puppet-latest.tgz -----: 1

# untar and install it
$ gzip -d -c puppet-latest.tgz | tar xf - ----: 2
$ cd puppet-* ------: 3
$ sudo ruby install.rb # or become root and run install.rb -------: 4

Installing Puppet and Facter Using Ruby Gem

# Installing Facter
$ wget http://puppetlabs.com/downloads/gems/facter-1.5.7.gem
$ sudo gem install facter-1.5.7.gem

# Installing Puppet
$ wget http://puppetlabs.com/downloads/gems/puppet-0.25.1.gem
$ sudo gem install puppet-0.25.1.gem