Puppet3在CentOS6.5叢集下的安裝,puppet3centos6.5
環境:3台主機,
IP分別為10.211.55.11、12、13
puppet master安裝在10.211.55.11
puppet agent安裝在10.211.55.11、12、13
1、安裝EPEL庫 後面安裝puppet Dashboard需要
yum install yum-prioritiesrpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm —import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
其中源可以替換為國內鏡像
http://mirrors.ustc.edu.cn/fedora/epel/epel-release-latest-6.noarch.rpmhttp://mirrors.ustc.edu.cn/fedora/epel/RPM-GPG-KEY-EPEL-6
修改/etc/yum.repos.d/epel.repo檔案
在[epel]最後添加一條屬性
priority=11
意思是yum先去官方源查,官方沒有再去epel的源找
2、在10.211.55.11上安裝dnsmasq網域名稱解析服務
yum install dnsmasqchkconfig dnsmasq onservice dnsmasq startlokkit -p 53:udp(開啟iptables 53連接埠)echo "10.211.55.11 node01.myhost.com" >> /etc/hosts
修改dnsmasq.conf
interface=eth0listen-address=10.211.55.11bind-interfacesresolv-file=/etc/resolv.confaddn-hosts=/etc/hosts
三台主機上分別輸入
echo “nameserver 10.211.55.11” >> /etc/resolv.conf
改主機名稱
vi /etc/sysconfig/network 分別改為node01.myhost.com、node02.myhost.com、node03.myhost.com
驗證DNS是否成功
netstat -tunlp|grep 53dig node02.myhost.com
3、在10.211.55.11安裝時間同步伺服器
yum install ntpchkconfig ntpd onservice ntpd start
(待完善)
4、安裝Puppet
安裝官方源
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
匯入GPG密鑰(驗證封裝的完整性)
rpm --import http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
安裝
yum install puppet-serverservice puppetmaster startservice puppet startchkconfig puppetmaster onchkconfig puppet on
編輯/etc/puppet/puppet.conf
[agent]server = node01.myhost.com
自動簽名
cat > /etc/puppet/autosign.conf <
測試連接
puppet agent -t
刪除認證
find /var/lib/puppet/ssl -name localhost.pem -delete
常用資訊
puppet cert list -all(查看所有認證)cat /etc/sysconfig/puppet(預設配置)/var/lib/puppet (agent認證位置)/etc/puppet/puppet.conf (設定檔)/usr/share/puppet (安裝位置)puppet config print modulepath(查看模組位置)puppet agent -t --summarize(查看報告)
5、安裝Dashboard 安裝
yum install -y mysql mysql-devel mysql-server httpd mod_passenger puppet-dashboard
mod_passenger是讓apache支援ruby
配置:
/etc/my.cnf,
在[mysqld]欄位,增加最後一行
# Allowing 32MB allows an occasional 17MB row with plenty of spare roommax_allowed_packet = 32M
/etc/init.d/mysqld startchkconfig mysqld onchkconfig httpd onservice httpd startmysqladmin -u root password 'password'
建立一個dashboard資料庫
mysql -uroot -ppassword <
編輯 /usr/share/puppet-dashboard/config/database.yml
production: database: dashboard username: dashboard password: password encoding: utf8 adapter: mysql
修改時區 /usr/share/puppet-dashboard/config/environment.rb
#config.time_zone = 'UTC' config.time_zone = 'Beijing'
初始化資料庫
cd /usr/share/puppet-dashboard/rake RAILS_ENV=production db:migrate
配置Apache
cat > /etc/httpd/conf.d/passenger.conf << EOFLoadModule passenger_module modules/mod_passenger.so PassengerRoot /usr/share/rubygems/gems/passenger-3.0.17 PassengerRuby /usr/bin/ruby PassengerHighPerformance on PassengerMaxPoolSize 12 PassengerPoolIdleTime 1500 PassengerStatThrottleRate 120 RailsAutoDetect On ServerName node01.myhost.com DocumentRoot "/usr/share/puppet-dashboard/public/" <Directory "/usr/share/puppet-dashboard/public/"> Options None AllowOverride AuthConfig Order allow,deny allow from all ErrorLog /var/log/httpd/node01.myhost.com_error.log LogLevel warn CustomLog /var/log/httpd/node06.chenshake.com_access.log combined ServerSignature On EOF/etc/init.d/httpd startchkconfig httpd onlokkit -p 80:tcp
配置puppet
# puppet.conf (on puppet master) [master] reports = store, http reporturl = http://node06.chenshake.com:80/reports/upload
/etc/init.d/puppetmaster restart
匯入報告
cd /usr/share/puppet-dashboardrake gems:refresh_specsrake RAILS_ENV=production reports:importDelayed Job Workersenv RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m startps -ef|grep delayed_job|grep -v grepenv RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m stop
這個時候你才能在Dashbaord裡看到資料
6、安裝Foreman (待完善)
參考:
http://www.chenshake.com/puppet-study-notes/
http://acooly.iteye.com/blog/1993484