一、 安装ruby
1.tar -xczf ruby-1.8.7-p352.tar.gz
2../configure --prefix=/usr/local/ruby
3.make
4.make install
5.ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby (必须)
1.yum erase ruby*
2.mv /usr/lib/ruby /tmp
关于`require': no such file to load -- puppet/application/master
1.chmod 0644 /usr/local/ruby/lib/ruby/site_ruby/1.8/puppet/rails/inventory_node.rb
2.lib/puppet/rails/host.rb -> /usr/local/ruby/lib/ruby/site_ruby/1.8/puppet/rails/host.rb
yum –y install ruby ruby-devel ruby-rdoc ruby-irb
Server端安装:
1、时间同步
ntpdate time.nist.gov
2、安装Facter用来获取客户端系统信息(如hostname,ip,OS-Version,fqdn等)
[root@testsns opt]# tar zxvf facter-1.6.5.tar.gz
[root@testsns opt]# cd facter-1.6.5
[root@testsns facter-1.6.5]# ruby install.rb
[root@testsns facter-1.6.5]# cd ..
[root@testsns opt]# tar zxvf puppet-2.6.13.tar.gz
[root@testsns opt]# cd puppet-2.6.13
[root@testsns puppet-2.6.13]# ruby install.rb
[root@testsns puppet-2.6.13]# cp conf/auth.conf /etc/puppet/
[root@testsns puppet-2.6.13]# cp conf/redhat/fileserver.conf /etc/puppet/
[root@testsns puppet-2.6.13]# cp conf/redhat/puppet.conf /etc/puppet/
[root@testsns puppet-2.6.13]# cp conf/redhat/server.init /etc/init.d/puppetmaster
[root@testsns puppet-2.6.13]# chmod +x /etc/init.d/puppetmaster
[root@testsns puppet-2.6.13]# chkconfig --add puppetmaster
[root@testsns puppet-2.6.13]# chkconfig puppetmaster on
[root@testsns puppet-2.6.13]# mkdir -p /etc/puppet/manifests
4、生成pupput用户
[root@testsns opt]# puppetmasterd –mkusers
-rw-r--r-- 1 root root 2552 06-05 01:29 auth.conf
-rwxr-xr-x 1 root root 381 2012-06-05 fileserver.conf
drwxr-xr-x 2 root root 4096 2012-06-05 manifests
-rwxr-xr-x 1 root root 853 2012-06-05 puppet.conf
[root@puppet puppet-2.7.14]# cat /etc/passwd |grep puppet
[root@puppet puppet-2.7.14]# ll /var/lib/puppet/
drwxr-x--- 2 puppet puppet 4096 06-05 18:49 bucket
drwxr-xr-x 2 root root 4096 06-05 18:49 facts
drwxr-xr-x 2 root root 4096 06-05 18:49 lib
drwxr-x--- 2 puppet puppet 4096 06-05 18:49 reports
drwxr-x--- 2 puppet puppet 4096 06-05 18:49 rrd
drwxr-x--- 2 puppet puppet 4096 06-05 18:49 server_data
drwxrwx--x 8 puppet root 4096 06-05 18:50 ssl
drwxr-xr-t 2 root root 4096 06-05 18:49 state
drwxr-x--- 2 puppet puppet 4096 06-05 18:49 yaml
tcp 0 0 0.0.0.0:8140 0.0.0.0:* LISTEN 2993/ruby [root@server ~]# ps -ef|grep puppet|grep -v grep
puppet 2993 1 0 10:57 ? 00:00:00 /usr/bin/ruby /usr/sbin/puppetmasterd
5、启动
[root@testsns opt]# /etc/init.d/puppetmaster start
6、修改hosts
修改双方的/etc/hosts文件,添加各自的IP地址对应的主机名,生产环境做内部DNS比较好,不用修改每台服务器的hosts文件。
192.168.1.166 server.viong.com
192.168.1.167 client1.viong.com
[root@puppet puppet-2.7.14]#vi /etc/resolv.conf
3、生成用户和rra目录
[root@nfstest puppet]# puppetmasterd –mkusers
[root@puppet puppet-2.7.14]# groupadd puppet;useradd -g puppet -M puppet
[root@puppet puppet-2.7.14]# service puppet start
4、启动
[root@nfstest puppet]# /etc/init.d/puppet start
5、修改hosts
修改双方的/etc/hosts文件,添加各自的IP地址对应的主机名,生产环境做内部DNS比较好,不用修改每台服务器的hosts文件。
192.168.1.166 server.viong.com
192.168.1.167 client1.viong.com
[root@puppet puppet-2.7.14]#vi /etc/resolv.conf
6、开放端口
关闭双方的防火墙及selinux,或开放8140(server服务器端口),8139(client服务器端口)。相互作ping hostname telnet hostname 8140 test hostname 8139等,看网络及hosts是否正常
客户端发送请求
puppetd --test --server server.viong.com
client1.viong.com (B0:85:72:E6:7D:63:EA:CC:BD:0C:E4:F1:70:89:24:70)
[root@server ~]# puppetca -s client1.viong.com
notice: Signed certificate request for client1.viong.com
notice: Removing file Puppet::SSL::CertificateRequest client1.viong.com at
+ server.viong.com (43:33:D3:A0:26:C4:E9:89:66:A6:DC:54:20:90:E9:4D) (alt names:
DNS:puppet, DNS:puppet.viong.com, DNS:server.viong.com)
[root@client1 puppet-2.7.14]# puppetd --test --server server.viong.com
[root@server ~]# md5sum /var/lib/puppet/ssl/ca/signed/client1.viong.com.pem
[root@client1 puppet-2.7.14]# md5sum /var/lib/puppet/ssl/certs/client1.viong.com.pem
[root@server ca]# rm -rf /var/lib/puppet/ssl/ca/signed/client1.viong.com.pem
本文出自 “TNT、运维之路” 博客,谢绝转载!