您好,登录后才能下订单哦!
环境:CentOS 6.5 x86_64
安装依赖环境:
ruby 1.8:yum安装
ruby gem:yum安装
openssl:yum安装
gcc 编译环境:yum安装
# yum install ruby gcc glibc rubygems openssl*
2. 安装好后可以安装 hiera、facter、puppet了。
下载源码包。
puppet官方源码包下载地址: https://downloads.puppetlabs.com/
hiera版本:1.3.4
facter版本:2.4.5
puppet版本:3.8.5
# tar xf hiera-1.3.4.tar.gz # ruby hiera-1.3.4/install.rb # tar xf facter-2.4.5.tar.gz # ruby facter-2.4.5/install.rb # tar xf puppet-3.8.5.tar.gz # ruby puppet-3.8.5/install.rb # puppet -V #查看版本号 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- json (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/module.rb:3 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/files.rb:1 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/templatewrapper.rb:1 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/scope.rb:6 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/methods.rb:2 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/method_call.rb:2 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:115 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser/parser.rb:11 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/parser.rb:4 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet.rb:282 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:12 from /usr/bin/puppet:7:in `require' from /usr/bin/puppet:7
报错,gem里面的json软件包没有安装。
# yum install rubygem-json # 发现没有该软件包
我这里选择用yum的方式安装 rubygem-json ,首选要安装puppet 的源。
# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm # yum install rubygem-json # 或者 gem install json
可以正常运行了。
3. 配置puppet 服务脚本
# cp puppet-3.8.5/ext/redhat/client.init /etc/init.d/puppet #puppet agent端服务脚本 # cp puppet-3.8.5/ext/redhat/master.init /etc/init.d/puppetmaster #puppet master端服务脚本 # chmod +x /etc/init.d/puppet* # service puppet start
可以正常启动。
其实puppet的安装 本人在这里并不推荐使用源码的方式来安装,反倒推荐使用puppetlabs官方的源来yum安装。另外后续的mCollective以及其依赖 也可以通过官方的源来安装。
1,安装puppetlabs官方yum源
# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
2,安装ruby环境,和ruby-gems (必须是1.8.7版本)
# yum install ruby rubygems
3,安装puppet 客户端(会自动处理依赖关系)
# yum install puppet
客户端的服务脚本为/etc/init.d/puppet
4,安装puppet master服务端(注意如果主机上安装有epel源,那么epel源也有个puppet服务端,不过是很老的版本,包名叫做puppetserver,在这里不适用,可不要安装错了!)
# yum install puppet-server
服务端的服务脚本为/etc/init.d/puppetmaster 注意区分。
安装完成!
另外,我这里推荐主机的FQDN名称记录到相应的DNS记录中。那样你用facter获取到的fqdn才是主机的真实fqdn。 我遇到过这样的情况,客户端在向puppet server申请证书的时候,使用的是fqdn前面的主机名(例如设置hostname为server1.localdomain,那么向master发送的证书是server1,并不是server1.localdomain),结果我搞了好久,发现facter中的domain值没有获取到,facter fqdn出来的结果也只是server1 ,结果查看了源代码,发现最好把hostanme设置为DNS中存在的主机, 实验环境下可以在/etc/resolv.conf 中添加一条 domain localdomain,强制指定domain字段。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。