yum安装puppet

yum安装puppet

author:headsen chen     2017-10-31  17:09:35

个人原创,转载请注明作者和出处,否则依法追究法律责任:

环境:centos 6.5

[root@server ~]# uname -a
Linux server.com 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 21:22:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

安装puppet的yum源,默认的yum仓库和epel的扩展库里都没有puppet的安装包

wget http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-1.noarch.rpm

yum install puppetlabs-release-6-1.noarch.rpm 

yum update

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

主机端:

 

[root@server ~]# yum -y install ruby facter puppet-server

 主机端启动

service puppet start
service puppetmaster start
设置开机自启动 chkconfig puppet on chkconfig puppetmaster on
 
以上过程全部的操作代码:

[root@smb ~]# wget http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-1.noarch.rpm
...

[root@smb ~]# ls
anaconda-ks.cfg Downloads kaifa Public ulian
Desktop install.log Music puppetlabs-release-6-1.noarch.rpm Videos
Documents install.log.syslog Pictures Templates
[root@smb ~]# rpm -ivh puppetlabs-release-6-1.noarch.rpm
warning: puppetlabs-release-6-1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
Preparing... ########################################### [100%]
1:puppetlabs-release ########################################### [100%]
[root@smb ~]# ls
anaconda-ks.cfg Downloads kaifa Public ulian
Desktop install.log Music puppetlabs-release-6-1.noarch.rpm Videos
Documents install.log.syslog Pictures Templates
[root@smb ~]# yum update
...

[root@smb ~]# yum repolist
...
base CentOS-6 - Base - mirrors.aliyun.com                                                6,706
extras CentOS-6 - Extras - mirrors.aliyun.com                                                 45
puppetlabs-deps Puppet Labs Dependencies El 6 - x86_64                          77
puppetlabs-products Puppet Labs Products El 6 - x86_64                             564
updates CentOS-6 - Updates - mirrors.aliyun.com                                         642
repolist:     8,034
[root@smb ~]# yum install puppet-server facter ruby

[root@smb ~]# service puppet start        ------------------------------------------------------------------------- 这一步不能报错。若报错则要重新安装!!!!!!!
Starting puppet agent: [ OK ]
[root@smb ~]# service puppetmaster start
Starting puppetmaster: [ OK ]
[root@smb ~]# chkconfig puppet on
[root@smb ~]# chkconfig puppetmaster on
[root@smb ~]#

 

 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

客户端:

[root@localhost ~]# echo "192.168.115.81 server.com" >>/etc/hosts
[root@localhost ~]# echo "192.168.115.87 client.com" >>/etc/hosts
[root@localhost ~]# vim /etc/sysconfig/network
[root@localhost ~]# hostname client.com
[root@localhost ~]# hostname
client.com

[root@localhost ~]# ping client.com
PING client.com (192.168.115.87) 56(84) bytes of data.
64 bytes from client.com (192.168.115.87): icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from client.com (192.168.115.87): icmp_seq=2 ttl=64 time=0.024 ms
^C
--- client.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1734ms
rtt min/avg/max/mdev = 0.024/0.032/0.040/0.008 ms
[root@localhost ~]# ping server.com

[root@localhost ~]# yum -y install ntpdate
...
[root@localhost ~]# ntpdate ntp.api.bz
31 Oct 16:37:48 ntpdate[3577]: step time server 115.28.122.198 offset 5941581.400510 sec
[root@localhost ~]# date
Tue Oct 31 16:37:50 HKT 2017
[root@localhost ~]# mv /etc/localtime /etc/localtime.bak
[root@localhost ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@localhost ~]# date
Tue Oct 31 16:38:23 CST 2017
[root@localhost ~]# date
Tue Oct 31 16:38:28 CST 2017
[root@localhost ~]# hwclock -w
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.115.81 server.com
192.168.115.87 client.com

[root@localhost ~]# wget http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-1.noarch.rpm
...

[root@localhost ~]# yum install puppetlabs-release-6-1.noarch.rpm

[root@localhost ~]# yum update

Complete!

[root@localhost ~]# yum install -y ruby facter puppet

[root@localhost ~]# service puppet start

Starting puppet agent: [ OK ]     ------------------------------------------------------------------- 此处不能报错,若报错则应重新安装!!!
[root@localhost ~]# chkconfig puppet on
[root@localhost ~]# vim /etc/puppet/puppet.conf

末行添加:server=master.com
[root@localhost ~]# service puppet restart
Stopping puppet agent: [ OK ]
Starting puppet agent: [ OK ]
[root@localhost ~]#

 

 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

配置主机端自动分发验证:

设置master自动签发所有的证书,创建 autosign.conf文件。

原文地址:https://www.cnblogs.com/kaishirenshi/p/7762972.html