環(huán)境:CentOS 6.5 x86_64
站在用戶的角度思考問題,與客戶深入溝通,找到孟州網(wǎng)站設(shè)計與孟州網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:網(wǎng)站制作、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、國際域名空間、網(wǎng)站空間、企業(yè)郵箱。業(yè)務(wù)覆蓋孟州地區(qū)。
安裝依賴環(huán)境:
ruby 1.8:yum安裝
ruby gem:yum安裝
openssl:yum安裝
gcc 編譯環(huán)境: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 # 發(fā)現(xiàn)沒有該軟件包
我這里選擇用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 服務(wù)腳本
# cp puppet-3.8.5/ext/redhat/client.init /etc/init.d/puppet #puppet agent端服務(wù)腳本 # cp puppet-3.8.5/ext/redhat/master.init /etc/init.d/puppetmaster #puppet master端服務(wù)腳本 # chmod +x /etc/init.d/puppet* # service puppet start
可以正常啟動。
其實puppet的安裝 本人在這里并不推薦使用源碼的方式來安裝,反倒推薦使用puppetlabs官方的源來yum安裝。另外后續(xù)的mCollective以及其依賴 也可以通過官方的源來安裝。
1,安裝puppetlabs官方y(tǒng)um源
# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
2,安裝ruby環(huán)境,和ruby-gems (必須是1.8.7版本)
# yum install ruby rubygems
3,安裝puppet 客戶端(會自動處理依賴關(guān)系)
# yum install puppet
客戶端的服務(wù)腳本為/etc/init.d/puppet
4,安裝puppet master服務(wù)端(注意如果主機上安裝有epel源,那么epel源也有個puppet服務(wù)端,不過是很老的版本,包名叫做puppetserver,在這里不適用,可不要安裝錯了?。?/p>
# yum install puppet-server
服務(wù)端的服務(wù)腳本為/etc/init.d/puppetmaster 注意區(qū)分。
安裝完成!
另外,我這里推薦主機的FQDN名稱記錄到相應(yīng)的DNS記錄中。那樣你用facter獲取到的fqdn才是主機的真實fqdn。 我遇到過這樣的情況,客戶端在向puppet server申請證書的時候,使用的是fqdn前面的主機名(例如設(shè)置hostname為server1.localdomain,那么向master發(fā)送的證書是server1,并不是server1.localdomain),結(jié)果我搞了好久,發(fā)現(xiàn)facter中的domain值沒有獲取到,facter fqdn出來的結(jié)果也只是server1 ,結(jié)果查看了源代碼,發(fā)現(xiàn)最好把hostanme設(shè)置為DNS中存在的主機, 實驗環(huán)境下可以在/etc/resolv.conf 中添加一條 domain localdomain,強制指定domain字段。