Puppet 源码方式安装与配置

 

1.安装前的准备工作 (YUM 前面几个步骤一致)

 

2.下载相应的源码包

 

[root@master1 ~]# cd /usr/local/src

[root@master1 src]# wget http://downloads.puppetlabs.com/puppet/puppet-3.5.1.tar.gz   

[root@master1 src]# wget https://downloads.puppetlabs.com/facter/facter-2.0.1.tar.gz

[root@master1 src]# wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz

 

3.源码包安装的顺序

ruby -> facter -> puppet

 

3.1安装ruby

[root@master1 src]# tar zxvf ruby-2.1.2.tar.gz

[root@master1 src]# cd ruby-2.1.2

[root@master1 ruby-2.1.2]# ./configure --prefix=/usr/local/ruby

[root@master1 ruby-2.1.2]# make && make install

#添加环境变量

[root@master1 ruby-2.1.2]# vi /etc/profile

export PATH=$PATH:/usr/local/ruby/bin

[root@master1 ruby-2.1.2]# source /etc/profile

 

3.2 安装facter

[root@master1 ruby-2.1.2]# cd ..

[root@master1 src]# tar zxvf facter-2.0.1.tar.gz

[root@master1 src]# cd facter-2.0.1

[root@master1 facter-2.0.1]# ruby install.rb

 

3.3 安装puppet

[root@master1 facter-2.0.1]# cd ..

[root@master1 src]# useradd -M -s /sbin/nologin puppet

[root@master1 src]# tar fzvx puppet-3.5.1.tar.gz

[root@master1 src]# cd puppet-3.5.1

[root@master1 puppet-3.5.1]# ruby install.rb

[root@master1 puppet-3.5.1]# cp conf/redhat/puppet.conf /etc/puppet/puppet.conf

[root@master1 puppet-3.5.1]# vi /etc/puppet/puppet.conf

#[main]中增加:

server = master1.jun.com     #master的主机名

certname = master1.jun.com    #master的主机名

pluginsync = false

 

 

3.4.启动puppet

[root@master1 puppet-3.5.1]# puppet master

[root@master1 puppet-3.5.1]# ps -ef |grep master

puppet   11503     1  0 12:24 ?        00:00:01 /usr/local/ruby/bin/ruby /usr/local/ruby/bin/puppet master

 

 

4.client/agent 端安装puppet

4.1安装ruby

[root@client src]# tar zxvf ruby-2.1.2.tar.gz

[root@client src]# cd ruby-2.1.2

[root@client ruby-2.1.2]# ./configure --prefix=/usr/local/ruby

[root@client ruby-2.1.2]# make && make install

#添加环境变量

[root@client ruby-2.1.2]# vi /etc/profile.d/ruby.sh

export PATH=$PATH:/usr/local/ruby/bin

[root@client ruby-2.1.2]# source /etc/profile

 

4.2 安装facter

[root@client ruby-2.1.2]# cd ..

[root@client soft]# tar zxvf facter-2.0.1.tar.gz

[root@client soft]# cd facter-2.0.1

[root@client facter-2.0.1]# ruby install.rb

 

4.3 安装puppet

[root@client facter-2.0.1]# cd ..

[root@client soft]# useradd -M -s /sbin/nologin puppet

[root@client soft]# tar fzvx puppet-3.5.1.tar.gz

[root@client soft]# cd puppet-3.5.1

[root@client puppet-3.5.1]# ruby install.rb

[root@client puppet-3.5.1]# cp ext/redhat/puppet.conf /etc/puppet/puppet.conf

[root@client puppet-3.5.1]# vi /etc/puppet/puppet.conf

#[main]中增加:

server = master1.jun.com      #master的主机名

pluginsync = false

 

5.认证授权

5.1 Client agent连接server

[root@client ~]# puppet agent --server=master1.jun.com

 

5.2 master 端查看申请证书请求

[root@master1 ~]# puppet cert --list

 

5.3 master 上签发证书

[root@master1 ~]# puppet cert --sign client

 

6.文件分发验证

6.1 master 上创建一个site.pp 文件

[root@master1 ~]# vi /etc/puppet/manifests/site.pp

node default{

    file{

        "/tmp/test.txt": content=>"Hello, Puppet!"

    }

}

 

6.2 client 进行验证, 如果/tmp/test.txt 文件同步过来,代表puppet 安装是正确的,

其他的案例, 参考 <安装与配置详细配置及实例>> + 《单机模式》