目录

Use Puppet

安装准备

两台centos6.6_x64机器

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
master192.168.99.234-web1.mulinux.com;slave192.168.99.235-web2.mulinux.com
[root@localhost ~]# hostname web1.mulinux.com
[root@localhost ~]# bash
[root@web1 ~]# vi /etc/sysconfig/network
HOSTNAME=web1.mulinux.com
[root@web1 ~]# iptables -F
[root@web1 ~]# service iptables save
[root@web1 ~]# vi /etc/selinux/config
SELINUX=disabled
[root@web1 ~]# setenforce 0
[root@web1 ~]# getenforce
[root@web1 ~]# vi /etc/hosts
192.168.99.234 web1.mulinux.com
192.168.99.235 web2.mulinux.com
[root@web1 ~]# ping web1.mulinux.com
[root@web1 ~]# ping web2.mulinux.com
[root@web1 ~]# yum install -y ntp
[root@web1 ~]# crontab -e
*/10 * * * * ntpdate time.windows.com >/dev/null 2>&1
web2同上操作

服务端安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[root@web1 ~]# rpm -ivh http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
[root@web1 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo
CentOS-Debuginfo.repo  CentOS-Media.repo      puppetlabs.repo
[root@web1 ~]# yum list | grep puppet
[root@web1 ~]# yum install -y puppet-server
[root@web1 ~]# service puppetmaster start
Starting puppetmaster:                                     [  OK  ]
[root@web1 ~]# chkconfig puppetmaster on
[root@web1 ~]# ps aux | grep puppet
puppet     1682  0.4  6.7 169276 68088 ?        Ssl  19:03   0:01 /usr/bin/ruby /usr/bin/puppet master
root       1688  0.0  0.0 103244   864 pts/0    S+   19:07   0:00 grep puppet
[root@web1 ~]# netstat -lnp | grep ruby

客户端安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[root@web2 ~]# rpm -ivh http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
[root@web2 ~]# yum install -y puppet
[root@web2 ~]# service puppet start
Starting puppet agent:                                     [  OK  ]
[root@web2 ~]# chkconfig puppet on
[root@web2 ~]# ps aux | grep puppet
root       1340  1.3  6.4 167220 64400 ?        Ss   19:14   0:00 /usr/bin/ruby /usr/bin/puppet agent
root       1346  0.0  0.0 103244   860 pts/0    S+   19:15   0:00 grep puppet
[root@web2 ~]# vi /etc/puppet/puppet.conf
    listen = true #追加到文件即可
    server = web1.mulinux.com
    runinterval =30
[root@web2 ~]# /etc/init.d/postfix stop #关闭这个服务后再检查端口就不用看那么多了。netstat -lnp