Puppet集中配置管理系統[安裝與配置]

Puppet集中配置管理系統[安裝與配置] 2011-01-16 10:15:09

標籤:puppet
原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責任。http://liuyu.blog.51cto.com/183345/479214
 安裝Puppet
2.1 安裝需求
       注:本文都是在Centos5下進行安裝與配置。其它系統請參考官網。
           Ruby 1.8.2+ facter
              其它的庫:
base64
cgi
digest/md5
etc
fileutils
ipaddr
openssl
strscan
syslog
uri
webrick
webrick/https
xmlrpc
 
2.2 Puppet 版本
 2.6.4
 0.25.5
 2.6.4和0.25.5 有功能和基本命令上有一些變化區別如下:
 puppetmasterd → puppet master
puppetd → puppet agent
puppet → puppet apply
puppetca → puppet cert
ralsh → puppet resource
puppetrun → puppet kick
puppetqd → puppet queue
filebucket → puppet filebucket
puppetdoc → puppet doc
pi → puppet describe
 
       通常我們使用epel安裝的puppet 都是0.25.5 。在安裝前做注意版本的區別。本文采用2.6.4版本,以下配置都是在2.6.4版本上完成。
      其它系統相關的情況詳見:(遺憾的是沒有看到對windows的支持)http://projects.puppetlabs.com/projects/puppet/wiki/Downloading_Puppet
 
 2.3源碼包安裝
       源碼包安裝時,版本沒有太多的區別。
 2.3.1 安裝ruby 最好使用RPM包安裝。可以採用epel 然後yum
                            http://mirrors.sohu.com/fedora-epel/5Server/ 下載相應版本的epel
                            yum install ruby ruby-devel ruby-doc*
 2.3.2 安裝facter
下載最新的版本:
$ wget http://puppetlabs.com/downloads/facter/facter-latest.tgz
$ gzip -d -c facter-latest.tgz | tar xf -
$ cd facter-*
$ sudo ruby install.rb #使用root 賬號執行
 
2.3.3# 下載最新版
$ wget http://puppetlabs.com/downloads/puppet/puppet-latest.tgz
# untar and install it
$ gzip -d -c puppet-latest.tgz | tar xf -
$ cd puppet-*
$ sudo ruby install.rb # 使用rot安裝
 
2.4 yum安裝
1. Epel 安裝0.25.5
2. 採用如下方式安裝2.6.4
2.4.1配置yum源
cd /etc/yum.repos.d/
vim puppet.repo
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/base/
enabled=0
gpgcheck=0</code></pre>
 
vim epel.repo
name=Extra Packages for Enterprise Linux 5 -$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&amp;arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=0
 
[epel-puppet]
name=epel puppet
baseurl=http://tmz.fedorapeople.org/repo/puppet/epel/5/$basearch/
enabled=0
gpgcheck=0
 
vim ruby.repo
[ruby]
name=ruby
baseurl=http://repo.premiumhelp.eu/ruby/
gpgcheck=0
enabled=0
2.4.2 升級ruby
puppet 2.6 需要 ruby 1.8.6 去運行 puppet-dashboard
升級ruby
 # yum --enablerepo="ruby" update ruby
 
如果你沒有安裝ruby 請使用:
#yum -y install ruby
2.4.3 安裝puppet
安裝 Puppet Server
Server端:On your puppetmaster server:
  # yum --enablerepo=epel,epel-puppet install puppet-server>
Client 端:On your puppet client
# yum --enablerepo="epel,epel-puppet" install puppet
 
2.5 gem 安裝
$ wget http://puppetlabs.com/downloads/gems/facter-1.5.7.gem
$ sudo gem install facter-1.5.7.gem
$ wget http://puppetlabs.com/downloads/gems/puppet-0.25.1.gem
 $ sudo gem install puppet-0.25.1.gem
 三、配置Puppet
 3.1 配置服務器端
 3.1.1設置hostname
                   #echo “puppetmaster.linuxtone.org” > /etc/hostname
                   #hostname –F /etc/hostname
3.1.2 配置site.pp
vim /etc/puppet/site.pp
node default {
file { “/tmp/temp1.txt”: content => “hello,first puppet manifest”; }
}
 3.2 配置客戶端
3.2.1設置hostname
#echo “puppetclient.linuxtone.org” > /etc/hostname
#hostname –F /etc/hostname
 3.1.2 指定hosts 或使用dns解析
 echo “192.168.1.100 puppetmaster.linuxtone.org” >> /etc/hosts
 3.3 驗證
 3.3.1 客戶端運行:
puppetd --server master.example.com(puppetmaster.linuxtone.org) --test
上面的命令讓puppetd 從 master.example.com(puppetmaster.linuxtone.org) 去讀取puppet配置文件. 第一次連接,雙方會進行ssl證書的驗證,這是一個新的客戶端,在服務器端那裏還沒有被認證,因此需要在服務器端進行證書認證.
在服務器端的機器上執行下面的命令來認證客戶端的證書
 3.3.2 服務器端運行: puppetca -s client.example.com
3.3.3 客戶端再次運行puppetd –server puppetmaster.linuxtone.org --test
       這樣驗證就算是做完了。客戶端會在/tmp目錄生成內容爲“hello,first puppet manifest”的temp1.txt 文件。
 
3.4 自動驗證
    在/etc/puppet 創建autosign.conf  
    內容 *.linuxtone.org
 
 
 
 
 
本文出自 “seven” 博客,請務必保留此出處http://liuyu.blog.51cto.com/183345/479214
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章