puppet安装
本帖最后由 i1zhuxian 于 2015-12-17 15:09 编辑#为方便配置selinux及iptables 均已关闭,在实际生产环境需要配置好ntp服务
#yum install ntp
#service ntpd start
#chkconfig ntpd on
1.配置ip 主机名及hosts文件
server
ip 192.168.122.21
hostname puppet-server.com
agent1
ip 192.168.122.22
hostname puppet-agent1.com
cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.122.21 puppet-server.com puppet-server
192.168.122.22 puppet-agent1.com puppet-agent
2.安装ruby ruby-libs ruby-shadow
[root@puppet-server ~]# yum install ruby ruby-libs ruby-shadow -y
[root@puppet-agent1 ~]# yum install ruby ruby-libs ruby-shadow -y
#server与agent都要安装
3 安装facter puppet和puppet-server
centos自带的yum源中并无puppet,需要先添加额外的yum源
[root@puppet-server ~]# rpm -Uvh http://yum.puppetlabs.com/el/6Server/products/x86_64/puppetlabs-release-6-6.noarch.rpm
[root@puppet-server ~]# yum clean all
[root@puppet-server ~]# yum makecache
#agent上要执行同样的操作
安装puppet puppet-server
[root@puppet-server ~]# yum install puppet-server -y
[root@puppet-agent1 ~]# yum install puppet -y
#因某些原因安装的时候总是出现无法链接的情况 多试几次运气好的话很快就好了 或者用个VPN代理
#yum 会自动解决依赖包 所以facter会被自动安装好
#末尾有puppet本地yum源的配置
4 配置puppet
server端
[root@puppet-server ~]# vi /etc/puppet/puppet.conf
添加如下内容:
certname=puppet-server.com
创建核心配置文件(现在为空白文件就可以)
[root@puppet-server ~]# touch /etc/puppet/manifests/site.pp
agent端
[root@puppet-agent1 ~]#vi /etc/puppet/puppet.conf
在中加入如下内容
server = puppet-server.com
5.启动及注册认证
启动master
[root@puppet-server ~]# service puppetmaster start
启动agent
[root@puppet-agent1 ~]# service puppet start
master端查看等待注册的有哪些机器
[root@puppet-server ~]# puppet cert --list
"puppet-agent1.com" (SHA256) A6:24:F4:6B:96:D6:AC:8E:FC:34:3A:98:33:60:D9:F6:74:E6:77:8F:EE:9B:AE:92:8A:39:01:1B:52:A4:4E:85
master同意注册
[root@puppet-server ~]# puppet cert --sign puppet-agent1.com
Notice: Signed certificate request for puppet-agent1.com
Notice: Removing file Puppet::SSL::CertificateRequest puppet-agent1.com at '/var/lib/puppet/ssl/ca/requests/puppet-agent1.com.pem'
ok 到这里puppet的安装及启动注册都已完成!
==============================================================================================================
因为网络问题,除非使用vpn代理,否则很难将puppet装上去。就做了个本地yum源,将puppet-rpm放到自己喜欢的目录下,然后写个.repo文件就OK了。
#如将其放到/opt/
vi /etc/yum.repos.d/puppet.repo
name=puppet.local.rpms
baseurl=file:///opt/puppet-rpm
enabled=1
gpgcheck=0
yum makecache
就可以直接使用yum安装了,不需要配置上面的yum.puppetlabs.com的源了。
下载地址: http://yunpan.cn/c3z4ALiSGWpZr访问密码 c128
学习了
页:
[1]