1 /* ---示例代码----*/
2
3 OS:CentOS-6.5-x86_64
4
5 Puppet 3.7.3
6
7 Puppet master: master.fisteam2.com
8
9 Puppet clients:node1-5.fisteam2.com
10
11 /* ---示例代码----*/
12
Puppet 要求所有机器有完整的域名(FQDN),如果没有 DNS 服务器提供域名的话,可以在两台机器上设置主机名(注意要先设置主机名再安装 Puppet,因为安装 Puppet 时会把主机名写入证书,客户端和服务端通信需要这个证书),因为我配置了DNS,所以就不用改hosts了,如果没有就需要改hosts文件指定。
1.关闭selinux,iptables,并设置ntp
采用CentOS-6.5-x86_64.iso进行minimal最小化安装
关闭selinux
1 /* ---示例代码----*/
2
3 [root@master ~]# cat /etc/selinux/config
4
5 # This file controls the state of SELinux on the system.
6
7 # SELINUX= can take one of these three values:
8
9 # enforcing - SELinux security policy is enforced.
10
11 # permissive - SELinux prints warnings instead of enforcing.
12
13 # disabled - No SELinux policy is loaded.
14
15 SELINUX=enforcing
16
17 # SELINUXTYPE= can take one of these two values:
18
19 # targeted - Targeted processes are protected,
20
21 # mls - Multi Level Security protection.
22
23 SELINUXTYPE=targeted
24
25 [root@master ~]# sed -i ‘/SELINUX/ s/enforcing/disabled/g‘ /etc/selinux/config
26
27 [root@master ~]# cat /etc/selinux/config
28
29 # This file controls the state of SELinux on the system.
30
31 # SELINUX= can take one of these three values:
32
33 # enforcing - SELinux security policy is enforced.
34
35 # permissive - SELinux prints warnings instead of enforcing.
36
37 # disabled - No SELinux policy is loaded.
38
39 SELINUX=disabled
40
41 # SELINUXTYPE= can take one of these two values:
42
43 # targeted - Targeted processes are protected,
44
45 # mls - Multi Level Security protection.
46
47 SELINUXTYPE=targeted
48
49 [root@master ~]# setenforce 0
50
51 /* ---示例代码----*/
52
53
停止iptables
1 /* ---示例代码----*/
2
3 [root@node1 ~]# chkconfig --list |grep tables
4
5 ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
6
7 iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
8
9 [root@node1 ~]# chkconfig ip6tables off
10
11 [root@node1 ~]# chkconfig iptables off
12
13 [root@node1 ~]# service ip6tables stop
14
15 ip6tables: Setting chains to policy ACCEPT: filter [ OK ]
16
17 ip6tables: Flushing firewall rules: [ OK ]
18
19 ip6tables: Unloading modules: [ OK ]
20
21 [root@node1 ~]# service iptables stop
22
23 iptables: Setting chains to policy ACCEPT: filter [ OK ]
24
25 iptables: Flushing firewall rules: [ OK ]
26
27 iptables: Unloading modules: [ OK ]
28
29 [root@node1 ~]#
30
31 /* ---示例代码----*/
32
设置ntp
1 /* ---示例代码----*/
2
3 [root@master ~]# ntpdate pool.ntp.org
4
5 [root@master ~]# chkconfig --list|grep ntp
6
7 ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
8
9 ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
10
11 [root@master ~]# chkconfig ntpd on
12
13 [root@master ~]# service ntpd start
14
15 Starting ntpd: [ OK ]
16
17 [root@master ~]#
18
19 /* ---示例代码----*/
2.安装puppet服务
puppet不在CentOS的基本源中,需要加入 PuppetLabs 提供的官方源:
1 /* ---示例代码----*/
2
3 [root@master ~]# wget http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
4
5 --2014-12-29 15:28:53-- http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
6
7 Resolving yum.puppetlabs.com... 198.58.114.168, 2600:3c00::f03c:91ff:fe69:6bf0
8
9 Connecting to yum.puppetlabs.com|198.58.114.168|:80... connected.
10
11 HTTP request sent, awaiting response... 200 OK
12
13 Length: 5712 (5.6K) [application/x-redhat-package-manager]
14
15 Saving to: “puppetlabs-release-6-7.noarch.rpm”
16
17 100%[======================================>] 5,712 --.-K/s in 0s
18
19 2014-12-29 15:28:53 (245 MB/s) - “puppetlabs-release-6-7.noarch.rpm” saved [5712/5712]
20
21 [root@master ~]# rpm -ivh puppetlabs-release-6-7.noarch.rpm
22
23 warning: puppetlabs-release-6-7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
24
25 Preparing... ########################################### [100%]
26
27 1:puppetlabs-release ########################################### [100%]
28
29 [root@master ~]#yum update
30
31 /* ---示例代码----*/
在 master上安装和启用 puppet 服务:
1 /* ---示例代码----*/
2
3
4 [root@master ~]# yum install puppet-server
5
6 ======================省略线===================================================
7
8
9 Dependencies Resolved
10
11
12 ================================================================================
13
14 Package Arch Version Repository Size
15
16 ================================================================================
17
18 Installing:
19
20 puppet-server noarch 3.7.3-1.el6 puppetlabs-products 24 k
21
22 Installing for dependencies:
23
24 augeas-libs x86_64 1.0.0-7.el6 base 313 k
25
26 facter x86_64 1:2.3.0-1.el6 puppetlabs-products 97 k
27
28 hiera noarch 1.3.4-1.el6 puppetlabs-products 23 k
29
30 libselinux-ruby x86_64 2.0.94-5.8.el6 base 100 k
31
32 puppet noarch 3.7.3-1.el6 puppetlabs-products 1.6 M
33
34 ruby x86_64 1.8.7.374-3.el6_6 updates 538 k
35
36 ruby-augeas x86_64 0.4.1-3.el6 puppetlabs-deps 21 k
37
38 ruby-irb x86_64 1.8.7.374-3.el6_6 updates 317 k
39
40 ruby-libs x86_64 1.8.7.374-3.el6_6 updates 1.7 M
41
42 ruby-rdoc x86_64 1.8.7.374-3.el6_6 updates 380 k
43
44 ruby-shadow x86_64 1:2.2.0-2.el6 puppetlabs-deps 13 k
45
46 rubygem-json x86_64 1.5.5-3.el6 puppetlabs-deps 763 k
47
48 rubygems noarch 1.3.7-5.el6 base 207 k
49
50
51 Transaction Summary
52
53 ========================省略线==================================================
54
55 Installed:
56
57 puppet-server.noarch 0:3.7.3-1.el6
58
59
60 Dependency Installed:
61
62 augeas-libs.x86_64 0:1.0.0-7.el6 facter.x86_64 1:2.3.0-1.el6
63
64 hiera.noarch 0:1.3.4-1.el6 libselinux-ruby.x86_64 0:2.0.94-5.8.el6
65
66 puppet.noarch 0:3.7.3-1.el6 ruby.x86_64 0:1.8.7.374-3.el6_6
67
68 ruby-augeas.x86_64 0:0.4.1-3.el6 ruby-irb.x86_64 0:1.8.7.374-3.el6_6
69
70 ruby-libs.x86_64 0:1.8.7.374-3.el6_6 ruby-rdoc.x86_64 0:1.8.7.374-3.el6_6
71
72 ruby-shadow.x86_64 1:2.2.0-2.el6 rubygem-json.x86_64 0:1.5.5-3.el6
73
74 rubygems.noarch 0:1.3.7-5.el6
75
76
77 Complete!
78
79 [root@master ~]# chkconfig --list |grep puppet
80
81 puppet 0:off 1:off 2:off 3:off 4:off 5:off 6:off
82
83 puppetmaster 0:off 1:off 2:off 3:off 4:off 5:off 6:off
84
85 [root@master ~]# chkconfig puppet on
86
87 [root@master ~]# service puppetmaster start
88
89 Starting puppetmaster: [ OK ]
90
91 [root@master ~]#
92
93
94 /* ---示例代码----*/
==============待续====================
本文出自 “王乾De技术博客” 博客,谢绝转载!
CentOS6.5+puppet3.7.3 安装、配置及测试(一)
原文地址:http://redking.blog.51cto.com/27212/1598248