zoukankan      html  css  js  c++  java
  • Puppet部署:安装puppet server、client

    Puppet部署:安装puppet server、client

     

    puppet与其他手工操作工具有一个最大的区别就是 puppet的配置具有稳定性,因此你可以多次执行puppet,一旦你更新了你的配置文件,puppet就会根据配置文件来更改你的机器配置,通常每30分钟检查一次。

    AD:2014WOT全球软件技术峰会北京站 课程视频发布

     

    puppet与其他手工操作工具有一个最大的区别就是 puppet的配置具有稳定性,因此你可以多次执行puppet, 一旦你更新了你的配置文件,puppet就会根据配置文件来更改你的机器配置,通常每30分钟检查一次. puppet会让你的系统状态同配置文件所要求的状态保持一致. 比如你配置文件里面要求ssh服务必须开启. 假如不小心ssh服务被关闭了,那么下一次执行puppet的时候,puppet会发现这个异常,然后会开启 ssh 服务. 以使系统状态和配置文件保持一致.puppet就象一个魔术师,会让你的混乱的系统收敛到puppet配置文件所想要的状态。

    可以使用puppet管理服务器的整个生命周期,从初始化到退役.不同于传统的例如sun的Jumpstart或者redhat的Kickstart, puppet可以长年让服务器保持最新状态.只要一开始就正确的配置他们,然后再也不用去管他们.通常puppet用户只需要给机器安装好puppet并让他们运行,然后剩余的工作都由puppet来完成。

    试验环境

    硬件:两台服务器,虚拟服务器或者物理机器都行,ip地址分别是 192.168.10.133 (server)和 192.168.10.207(client) ;下文分别用server和client代替两个服务器.

    软件:安装Centos 5X64(server),Ubuntu 12.04(client) 系统

    网络:两台机器互相能访问

    在server端配置: 1.设置主机名:

    1. [root@server ~]# uname -a  
    2. Linux server.puppet.com 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux  
    3. [root@server ~]# hostname  
    4. server.puppet.com  
    5. [root@server ~]# cat /etc/hosts  
    6. # Do not remove the following line, or various programs  
    7. # that require network functionality will fail.  
    8. 127.0.0.1 redmine localhost.localdomain localhost  
    9. ::1 localhost6.localdomain6 localhost6  
    10. 192.168.10.133 server.puppet.com server 

    2.配置server端的yum源(因为centos默认没有puppet 源,因此先配置puppet的源,下面链接失效可以参考:https://fedoraproject.org/wiki/EPEL/zh-cn.)

    1. [root@server ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 

    3.开始安装puppet server

    1. [root@server ~]# yum -y install puppet-server facter ruby ruby-libs ruby-shadow 

    4.yum安装puppet成功,先启动服务,查看安装成功否

    1. [root@server ~]# service puppetmaster start  
    2. Starting puppetmaster: [ OK ]  
    3. [root@server ~]# ps -ef | grep puppet  
    4. puppet 2937 1 0 11:47 ? 00:00:00 /usr/bin/ruby /usr/sbin/puppetmasterd  
    5. root 2943 2751 0 11:47 pts/1 00:00:00 grep puppet 

    个人喜欢先用

    1. [root@server ~]# puppet master --verbose --no-daemonize  
    2. notice: Starting Puppet master version 2.6.17 

    因为这个可以看到输出.跟后面的测试有关系,调试完毕.建议用守护进程方式启动

    现在看到server启动没有问题.现在可以出安装 ubuntu client了

    1.设置client的hostname

    1. liming@client:~$ hostname  
    2. client.puppet.com 

    2.设置server hosts(添加如下)

    1. liming@client:~$ sudo vim /etc/hosts  
    2. 192.168.10.133 server.puppet.com 

    3.设置ubuntu apt源

    1. liming@client:~$ sudo  su -  
    2.    
    3. liming@client:~$ echo -e "deb http://apt.puppetlabs.com/ lucid main deb-src http://apt.puppetlabs.com/ lucid main" >> /etc/apt/sources.list.d/puppet.list  
    4.    
    5. liming@client:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 4BD6EC30  
    6. liming@client:~$ sudo apt-get update 

    4.安装puppet 客户端

    sudo apt-get install puppet

    5.测试

    1. liming@client:~$ sudo puppet agent --server=server.puppet.com --no-daemonize --verbose --onetime  
    2. info: Creating a new SSL key for client.puppet.com  
    3. warning: peer certificate won't be verified in this SSL session  
    4. info: Caching certificate for ca  
    5. warning: peer certificate won't be verified in this SSL session  
    6. warning: peer certificate won't be verified in this SSL session  
    7. info: Creating a new SSL certificate request for client.puppet.com  
    8. info: Certificate Request fingerprint (md5): 54:CC:33:85:ED:4E:97:05:5F:6D:CE:D9:1F:1F:E9:BC  
    9. warning: peer certificate won't be verified in this SSL session  
    10. warning: peer certificate won't be verified in this SSL session  
    11. warning: peer certificate won't be verified in this SSL session 

    服务器端查看等待请求证书连接的客户端

    1. [root@server ~]# puppet cert --list  
    2. "client.puppet.com" (54:CC:33:85:ED:4E:97:05:5F:6D:CE:D9:1F:1F:E9:BC) 

    现在server和client 端都没问题.若想吧client 换成Centos   Or RHEL 重复server 2.配置puppet的yum源.直接yum install puppet 即可!

    出现的问题:

    1. liming@client:~$ puppetd --server server.puppet.com --test  
    2. err: Could not retrieve catalog from remote server: SSL_connect returned=errno=state=SSLv3 read server certificate B: certificate verify failed. This is often because the time is out of sync on the server or client  
    3. warning: Not using cache on failed catalog  
    4. err: Could not retrieve catalog; skipping run  
    5. err: Could not send report: SSL_connect returned=errno=state=SSLv3 read server certificate B: certificate verify failed. This is often because the time is out of sync on the server or client 

    【编辑推荐】

  • 相关阅读:
    URAL 1998 The old Padawan 二分
    URAL 1997 Those are not the droids you're looking for 二分图最大匹配
    URAL 1995 Illegal spices 贪心构造
    URAL 1993 This cheeseburger you don't need 模拟题
    URAL 1992 CVS
    URAL 1991 The battle near the swamp 水题
    Codeforces Beta Round #92 (Div. 1 Only) A. Prime Permutation 暴力
    Codeforces Beta Round #7 D. Palindrome Degree hash
    Codeforces Beta Round #7 C. Line Exgcd
    Codeforces Beta Round #7 B. Memory Manager 模拟题
  • 原文地址:https://www.cnblogs.com/L-H-R-X-hehe/p/3966525.html
Copyright © 2011-2022 走看看