您好,登錄后才能下訂單哦!
環境: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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。