Centos 6.5 X86_64 puppet 安装
安装前工作:1、主机名解析:
每一个node必须有唯一的hostname,并且通过DNS服务器能解析每个hostname,如果没有DNS服务器,可以编辑/etc/hosts文件。然后把此文件同步到各节点。
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.11node1.syt.comnode1
192.168.10.12node2.syt.comnode2
192.168.10.13node3.syt.comnode3
192.168.10.14node4.syt.comnode4
192.168.10.15node5.syt.comnode5
192.168.10.16node6.syt.comnode6
192.168.10.17node7.syt.comnode7
# for i in {1..7};do scp /etc/hosts192.168.10.1$i:/etc/ ;done 2、各个node之间配置双机互信
node1上执行:
# ssh-keygen -t rsa
# for i in {1..7};do ssh-copy-id -i node$i ;done
同上一次在node2....node7上面执行上述两条命令。
3、关闭防火墙和SELinux。
# for i in {1..7};do ssh node$i "chkconfig iptables off && service iptables stop && setenforce 0";done Note:master也可以不关闭防火墙
[*] Firewalls: The puppet master server must allow incoming
connections on port 8140, and agent nodes must be able to connect to the master
on that port
4、要保证各节点时间同步。
# for i in {1..7};do ssh node$i "ntpdate node1";done 安装puppet:
1、在各节点上面安装官方yum源RPM包。
# for i in {1..7};do ssh node$i "rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm";done
# for i in {1..7};do ssh node$i "rpm --import/etc/pki/rpm-gpg/RPM-GPG-KEY-*";done
puppet的安装依赖ruby,首先安装ruby依赖软件包(要求ruby的版本要>=1.87):
#yum install ruby ruby-libsruby-shadow
在所有节点上面安装puppet官方yum源:
For Red Hat Enterprise Linux and Derivatives
Note that RHEL 5 requires an updated Ruby ≥ 1.8.7 from our yum repo.
Enterprise Linux 7
$ sudo rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
Enterprise Linux 6
$ sudo rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
Enterprise Linux 5
$ sudo rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-5.noarch.rpm
After installing the repos, open your /etc/yum.repos.d/puppetlabs.repo file for editing. Locate the stanza, and change the value of the enabled key from 0 to 1:
name=Puppet Labs Devel <%= @dist.capitalize -%> <%= @version -%> - $basearch
baseurl=http://yum.puppetlabs.com/<%= @dist.downcase -%>/<%= @codename -%>/devel/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
# for i in {1..7};do ssh node$i "sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/puppetlabs.repo";done Step 1: Install Puppet on the Puppet Master Server
#yum install puppet-server
Step 2: Install Puppet on Agent Nodes
# yum install puppetfacter
Step 3:Configure a Puppet Master Server
master的主配置文件/etc/puppet/puppet.conf,这个配置文件在puppet安装时被创建,如果没有,可以使用
下面命令来创建一个简单的配置文件:
# puppet master --genconfig > /etc/puppet/puppet.conf.bak
用此命令重新生成的puppet.conf文件比默认的配置文件内容详细很多。
此配置文件分为三部分:
段用于存放全局配置
段用于配置puppet master
段用于配置puppetagent
注意:这个里面配置了两个certname名称,其中中配置的certname是为所有节点认证用的master名称,
中配置的certname是他本身agent的名称,当然不配置默认是和master的名称是一样的。
页:
[1]