puppet源码编译安装

puppet最新源码详细安装:node

在网上找了不少相关puppet的,有不少用yum安装,安装虽然成功了。可是有客户端相关过来请求,仍是会有问题。最佳的仍是源码安装。c++

1、下载地址:vim

puppet下载地址:
http://downloads.puppetlabs.com/puppet/puppet-2.7.13.tar.gzruby

facter下载地址:
http://downloads.puppetlabs.com/facter/facter-1.6.7.tar.gz
ruby下载地址:
http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz

2、环境准备:bash

一、时间必须一致:服务器

crontab -edom

 

  
  
  
  
  1. */2  *    *    *    *   /usr/sbin/ntpdate clock.nc.fukuoka-u.ac.jp >/dev/null 2>&1 

二、首先gcc相关可用yum安装ide

yum install gcc-c++  测试

yum install openssl*ui

三、服务器及客户端名字:

  
  
  
  
  1. [root@server bin]# more /etc/hosts 
  2. # Do not remove the following line, or various programs 
  3. # that require network functionality will fail. 
  4. #127.0.0.1              localhost.localdomain localhost 
  5. ::1             localhost6.localdomain6 localhost6 
  6. 192.168.1.231      server.cbcv.net        server 
  7. 192.168.1.232      client.cbcv.net        client 
  8. [root@server bin]# more /etc/sysconfig/network 
  9. NETWORKING=yes 
  10. NETWORKING_IPV6=no 
  11. HOSTNAME=server.cbcv.net 



<客户端也是相似同样,略......>
3、安装应用软件
一、首先安装ruby
tar -zxvf ruby-1.8.7.tar.gz
cd ruby-1.8.7
./configure --prefix=/usr/local/ruby
make
make install
操做系统PATH路径:

vi  /etc/profile
export PATH=/usr/local/ruby/bin:$PATH

查看ruby --version版本

二、安装facter
tar -zxvf facter-1.6.7.tar.gz
cd facter-1.6.7            
ruby install.rb

三、安装puppet

  
  
  
  
  1. tar -zxvf puppet-2.7.9.tar.gz 
  2.  
  3. cd puppet-2.7.9/ 
  4. ruby install.rb 
  5. [root@server puppet-2.7.9]# cp conf/auth.conf /etc/puppet/ 
  6. [root@server puppet-2.7.9]# cp conf/namespaceauth.conf /etc/puppet/ 
  7. [root@server puppet-2.7.9]# cp conf/redhat/puppet.conf /etc/puppet/ 
  8. [root@server puppet-2.7.9]# cp conf/redhat/server.init /etc/init.d/puppetmaster 
  9. [root@server puppet-2.7.9]# chmod +x /etc/init.d/puppetmaster 
  10. [root@server puppet-2.7.9]# /etc/init.d/puppetmaster start 
  11. Starting puppetmaster: /bin/bash: /usr/sbin/puppetmasterd: No such file or directory 
  12.                                                            [FAILED] 
  13.    
  14. [root@server puppet-2.7.9]# cp sbin/puppetmasterd /usr/sbin/ 
  15. [root@server puppet-2.7.9]# chmod -R 777 /usr/sbin/puppetmasterd 
  16. [root@server puppet-2.7.9]# cp sbin/puppetmasterd /bin/puppetmasterd 
  17. [root@server puppet-2.7.9]# chmod -R 777 /bin/puppetmasterd 
  18. [root@server puppet-2.7.9]# /etc/init.d/puppetmaster start          
  19. Starting puppetmaster: /usr/bin/env: ruby: No such file or directory 
  20.                                                            [FAILED] 
  21. [root@server puppet-2.7.9]# ln -s /usr/local/ruby/bin/ 
  22. erb         filebucket  pi          puppetdoc   rdoc        ruby        
  23. facter      irb         puppet      ralsh       ri          testrb      
  24. [root@server puppet-2.7.9]# ln -s /usr/local/ruby/bin/ruby /usr/bin/ 
  25. [root@server puppet-2.7.9]# /etc/init.d/puppetmaster start          
  26. Starting puppetmaster: Could not prepare for execution: Got 6 failure(s) while initializing: change from absent to directory failed: Could not set 'directory on ensure: Could not find group puppet; change from absent to directory failed: Could not set 'directory on ensure: Could not find group puppet; change from absent to directory failed: Could not set 'directory on ensure: Could not find group puppet; change from absent to directory failed: Could not set 'directory on ensure: Could not find group puppet; change from absent to directory failed: Could not set 'directory on ensure: Could not find group puppet; change from absent to directory failed: Could not set 'directory on ensure: Could not find group puppet 
  27.                                                            [FAILED] 
  28. [root@server puppet-2.7.9]# useradd puppet 
  29. [root@server puppet-2.7.9]# /etc/init.d/puppetmaster start 
  30. Starting puppetmaster:                                     [  OK  ] 
  31.  
  32. [root@server sbin]# pwd 
  33. /usr/local/src/puppet-2.7.9/sbin 
  34. cp -r * /usr/sbin/ 
  35.  
  36.  
  37. [root@server manifests]# chkconfig --add puppetmaster 
  38. [root@server manifests]# chkconfig puppetmaster on 




客户端其它安装和服务器安装相同,除了用cp conf/redhat/client.init /etc/init.d/puppet

  
  
  
  
  • tar -zxvf puppet-2.7.9.tar.gz 
  •  
  • cd puppet-2.7.9/ 
  • ruby install.rb
  
  
  
  
  1. [root@localhost puppet-2.7.9]# cp conf/auth.conf /etc/puppet/ 
  2. [root@localhost puppet-2.7.9]# cp conf/namespaceauth.conf /etc/puppet/ 
  3. [root@localhost puppet-2.7.9]# cp conf/redhat/puppet.conf /etc/puppet/ 
  4. [root@localhost puppet-2.7.9]# cp conf/redhat/client.init /etc/init.d/puppet 
  5. [root@localhost puppet-2.7.9]# chmod +x /etc/init.d/puppet  
  6. [root@localhost puppet-2.7.9]# service puppet start 
  7. Starting puppet: /bin/bash: /usr/sbin/puppetd: No such file or directory 
  8.                                                            [FAILED] 
  9. [root@localhost puppet-2.7.9]# cp sbin/puppetd /usr/sbin/puppetd 
  10. [root@localhost puppet-2.7.9]# service puppet start              
  11. Starting puppet: /usr/bin/env: ruby: No such file or directory 
  12.                                                            [FAILED] 
  13. [root@localhost puppet-2.7.9]# chmod +x /usr/sbin/puppetd  
  14. [root@localhost puppet-2.7.9]# service puppet start        
  15. Starting puppet: /usr/bin/env: ruby: No such file or directory 
  16.                                                            [FAILED] 
  17. [root@localhost puppet-2.7.9]# ln -s /usr/local/ruby/bin/ruby /usr/bin/ 
  18. [root@localhost puppet-2.7.9]# /etc/init.d/puppet start 
  19. Starting puppet:                                           [  OK  ] 


安装完毕后进行测试:

在服务器端执行:
 puppetca --list
应该是无
在客户端执行 puppetd --server server.cbcv.net  --test
再到服务器端执行:
puppetca –s client.cbcv.net
 clinet.cbcv.net (BF:5D:58:D0:F2:06:8C:FB:5C:AA:08:80:87:DC:92:20)

若是看到了客户端的证书请求,
针对客户端请求为
puppetca –s client.cbcv.net
用下面的命令对全部证书请求签名:
 puppetca -s –a

在主服务器上/etc/puppet/manifests

vi /etc/puppet/manifests/site.pp
node default{
   file { "/tmp/test.txt":
           content=> "hello, Test";
}
}

再重启一下服务器service puppetmaster restart 和客户端service puppet restart
再执行puppetd --server server.cbcv.net  --test
看/tmp下面是否是有test.txt文件了
 

增长多个site.pp

能够先在site.pp中增长

import "test.pp"

而后再在里面执行须要操做的内容。

可用puppetd --server server.cbcv.net  --test进行测试。

若是有报错:notice: Ignoring --listen on onetime run
notice: Skipping run of Puppet configuration client; administratively disabled; use 'puppet Puppet configuration client --enable' to re-enable.

那么须要在客户端执行puppet agent --enable便可。

puppet agent --disable为关闭。

 

记得重启puppetmaster和puppet
如下为参考内容,感受很是不错:
默认时间vim /etc/puppet/puppet.con
runinterval =1800 ###默认是30分钟,能够修改此处的值,单位为秒
有的时间修改了这个没有用,是什么缘由呢:
我也曾修改过屡次,没效果,后在客户端的配置文件再加了一句server = server.cbcv.net
而后重启
在客户端修改便可!最好重启一下server puppet restart

puppet 如何全客户端自动签名 
a.vim /etc/puppet/puppet.conf 
[puppetmaster]
autosign=true      #增长这两行
autosing=/etc/puppet/autosign.conf  
#增长这两行添加 
* 表示全部,或者添加域名,IP或者网段。举例:
b.再编辑 /etc/puppet/autosign.conf**.test.com192.168.0.1/24




错误总结<此错误是由于用了yum去安装。看到别人写的OK......>:
第一次认证的时候报下边的错误:
[root@client ~]# puppetd --server server.cbcv.net  --test
err: Could not retrieve catalog from remote server: certificate verify failed
我作测试发现的缘由有三种:
第一:是hostname没有设置好,在安装前必定要把hostname设置好,设置好以后尽可能重启机器。实在不行就删了从新安装。
第二:时间不一样步,时间不一样步也会报认证失败的错误,能够用date设置时间,只要不是差得太多就没事。
第三:是ssl的问题,在你用的这个客户端puppet已经作过其余的机器的客户端的状况下,由于已经生成的有证书,可能会和如今的冲突,把/var/lib/puppet/ssl这个文件夹删掉以后就好了。


1.3配置c/s模式的puppet的实验环境
Puppet的的客户端和服务端是靠ssl连接的,在服务端有一个自签名的根证书,在安装软件的时候自动生成。每一个客户端的证书要通过根证书签名才能和服务器链接。因此首先要在客户端执行下面的命令来请求服务器签名证书。
puppetd --server server.cbcv.net --test

相关文章
相关标签/搜索