第1回では、
Puppetのインストール
Puppetのインストール方法は、
- パッケージシステムによるインストール
- RubyGemsによるインストール
- tarballからのインストール
パッケージシステムによるインストールが最もお勧めです。
インストールの前提条件
PuppetはRubyでできているため、
また、
ただし、
また、
パッケージシステムによるインストール
以下のOSでは、
- Debian GNU/
Linux - RedHat Enterprise Linux/
CentOS - SuSE Linux
- Gentoo Linux
- Fedora
- FreeBSD
- OpenBSD
- Solaris
各OSでの具体的なインストール手順について、
Debian GNU/Linuxでのインストール
Debian GNU/
% sudo apt-get install puppet puppetmaster
詳細はPuppet本家のドキュメントをご参照ください。
Red Hat Enterprise Linux/CentOS でのインストール
Red Hat Enterprise Linux 4, 5や、
[dag]
name=DAG RPM Repository
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://ftp.riken.go.jp/pub/Linux/dag/RPM-GPG-KEY.dag.txt
といった内容で /etc/
$ sudo yum install puppet puppet-server
と実行することでインストールできます。
また、
あわせてPuppet本家のドキュメントもご参照ください。
SUSE Linuxでのインストール
SUSE Linuxの場合には、
適切なリポジトリをYaSTのインストールソースに追加し、
$ sudo yast -i puppet puppet-server
と実行することで、
openSUSE 10.
$ sudo zypper sa http://software.opensuse.org/download/systemmanagement:/misc/openSUSE_10.2 $ sudo zypper update $ sudo zypper install puppet puppet-server
あわせてPuppet本家のドキュメントもご参照ください。
Gentoo Linuxでのインストール
オフィシャルのPortageツリーでebuildが提供されています。デフォルトではpuppetとfacterはマスクされていて、
app-admin/puppet ~x86
dev-ruby/facter ~x86
という記述を追加し、
$ sudo emerge puppet
と実行してインストールします。
あわせてPuppet本家のドキュメントもご参照ください。
Fedoraでのインストール
Fedora Core 4, 5, 6の場合はFedora Extrasで、
$ sudo yum install puppet puppet-server
FreeBSDでのインストール
オフィシャルなパッケージが提供されていますので、
$ sudo pkg_add ftp://ftp8.jp.freebsd.org/pub/FreeBSD/ports/packages/All/puppet-0.22.3.tbz
あわせてPuppet本家のドキュメントもご参照ください。
OpenBSDでのインストール
オフィシャルなパッケージが提供されていますので、
$ export PKG_PATH=ftp://ftp.jp.openbsd.org/pub/OpenBSD/4.1/packages/`machine -a`/ $ sudo pkg_add ruby-puppet
あわせてPuppet本家のドキュメントもご参照ください。
Solarisでのインストール
Solarisの場合は、
$ cd /tmp $ ftp unix.hensa.ac.uk Connected to legunix.mirrorservice.org. 220 UK Mirror Service FTP server version 1.4 ready Name (unix.hensa.ac.uk:miya): anonymous 331 Guest login ok: please send your email address as the password Password: ftp> cd sites/blastwave.org ftp> get pkg_get.pkg ftp> get wget-i386.bin ftp> get wget-sparc.bin ftp> quit $ sudo pkgadd -d pkg_get.pkg $ sudo mv wget-`uname -p`.bin /opt/csw/bin/wget $ sudo chmod +x /opt/csw/bin/wget $ PATH=$PATH:/opt/csw/bin:/opt/csw/sbin $ sudo pkg-get -U $ sudo pkg-get install puppet
あわせてPuppet本家のドキュメントもご参照ください。
RubyGemsによるインストール
ご利用のOSでパッケージが提供されていない場合には、
$ sudo gem install --remote --source http://reductivelabs.com/downloads puppet
tarballからのインストール
パッケージシステムとRubyGemsを利用する以外にも、
# facterのインストール $ wget http://reductivelabs.com/downloads/facter/facter-latest.tgz $ gzip -d -c facter-latest.tgz | tar xf - $ cd facter-* $ sudo ruby install.rb # puppetのインストール $ wget http://reductivelabs.com/downloads/puppet/puppet-latest.tgz $ gzip -d -c puppet-latest.tgz | tar xf - $ cd puppet-* $ sudo ruby install.rb
Puppet起動前の準備
では、
起動前の準備として、
Ppuppetは基本的に、
Puppetサーバの起動
Puppetサーバを起動させるためには、
マニフェストとは、
今回は起動するだけですので、
$ sudo mkdir -p /etc/puppet/manifests $ sudo touch /etc/puppet/manifests/site.pp
では、
$ sudo puppetmasterd --verbose --mkusers info: Starting server for Puppet version 0.22.4 notice: /puppetconfig/puppet/Group[puppet]/ensure: created notice: /puppetconfig/puppet/User[puppet]/ensure: created info: Parsed manifest in 0.00 seconds info: Creating a new certificate request for server.example.com info: Creating a new SSL key at /etc/puppet/ssl/private_keys/server.example.com.pem info: Autosign is enabled but /etc/puppet/autosign.conf is missing info: Signing certificate for CA server info: Signing certificate for server.example.com info: Listening on port 8140 notice: Starting Puppet server version 0.22.4
2回目以降の起動や、
$ sudo puppetmasterd --verbose # puppetmasterd --verbose --nonode info: Starting server for Puppet version 0.22.4 info: Parsed manifest in 0.00 seconds info: Creating a new certificate request for server.example.com info: Creating a new SSL key at /etc/puppet/ssl/private_keys/server.example.com.pem info: Autosign is enabled but /etc/puppet/autosign.conf is missing info: Signing certificate for CA server info: Signing certificate for server.example.com info: Listening on port 8140 notice: Starting Puppet server version 0.22.4
--verboseオプションをつけることにより、
Puppetクライアントの起動
次にPuppetクライアント側で、
$ sudo puppetd --server server.example.com --verbose info: Creating a new certificate request for client.example.com info: Creating a new SSL key at /etc/puppet/ssl/private_keys/client.example.com.pem warning: peer certificate won't be verified in this SSL session notice: Did not receive certificate
Puppetサーバ/クライアント間は、
Puppetサーバ側では、
notice: Allowing unauthenticated client client.example.com(192.168.10.18) access to puppetca.getcert info: Autosign is enabled but /etc/puppet/autosign.conf is missing notice: Host client.example.com has a waiting certificate request
/etc/
$ sudo puppetca --list client.example.com $ sudo puppetca --sign client.example.com
puppetmasterdを停止させた場合には、
少し待つと、
notice: Got signed certificate notice: Starting Puppet client version 0.23.0 err: Could not retrieve configuration: Could not find client.example.com with names client.example.com, client err: Could not run Puppet::Network::Client::Master: Cannot connect to server and there is no cached configuration
エラーはPuppetサーバ上のマニフェストに、
以上がPuppetのインストールから起動までの流れとなります。次回は具体的なマニフェストを作成して、