您好,登錄后才能下訂單哦!
環(huán)境:CentOS 6.5 x86_64
安裝依賴環(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 #查看版本號(hào) /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
報(bào)錯(cuò),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
可以正常運(yùn)行了。
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
可以正常啟動(dòng)。
其實(shí)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 客戶端(會(huì)自動(dòng)處理依賴關(guān)系)
# yum install puppet
客戶端的服務(wù)腳本為/etc/init.d/puppet
4,安裝puppet master服務(wù)端(注意如果主機(jī)上安裝有epel源,那么epel源也有個(gè)puppet服務(wù)端,不過是很老的版本,包名叫做puppetserver,在這里不適用,可不要安裝錯(cuò)了!)
# yum install puppet-server
服務(wù)端的服務(wù)腳本為/etc/init.d/puppetmaster 注意區(qū)分。
安裝完成!
另外,我這里推薦主機(jī)的FQDN名稱記錄到相應(yīng)的DNS記錄中。那樣你用facter獲取到的fqdn才是主機(jī)的真實(shí)fqdn。 我遇到過這樣的情況,客戶端在向puppet server申請(qǐng)證書的時(shí)候,使用的是fqdn前面的主機(jī)名(例如設(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中存在的主機(jī), 實(shí)驗(yàn)環(huán)境下可以在/etc/resolv.conf 中添加一條 domain localdomain,強(qiáng)制指定domain字段。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。