环境:CentOS 6.5 x86_64
10年积累的网站设计制作、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有乳源免费网站建设让你可以放心的选择与我们合作。安装依赖环境:
ruby 1.8:yum安装
ruby gem:yum安装
openssl:yum安装
gcc 编译环境:yum安装
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.rpm2,安装ruby环境,和ruby-gems (必须是1.8.7版本)
# yum install ruby rubygems3,安装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字段。
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。