共计 4264 个字符,预计需要花费 11 分钟才能阅读完成。
Puppet3 在 CentOS6.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-priorities
rpm -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.rpm
http://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 dnsmasq
chkconfig dnsmasq on
service dnsmasq start
lokkit -p 53:udp(打开 iptables 53 端口)
echo “10.211.55.11 node01.myhost.com” >> /etc/hosts
修改 dnsmasq.conf
interface=eth0
listen-address=10.211.55.11
bind-interfaces
resolv-file=/etc/resolv.conf
addn-hosts=/etc/hosts
三台主机上分别输入
echo“nameserver 10.211.55.11”>> /etc/resolv.conf
改主机名
1
2
vi /etc/sysconfig/network
分别改为 node01.myhost.com、node02.myhost.com、node03.myhost.com
验证 DNS 是否成功
netstat -tunlp|grep 53
dig node02.myhost.com
3、在 10.211.55.11 安装时间同步服务器
yum install ntp
chkconfig ntpd on
service 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-server
service puppetmaster start
service puppet start
chkconfig puppetmaster on
chkconfig 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 room
max_allowed_packet = 32M
/etc/init.d/mysqld start
chkconfig mysqld on
chkconfig httpd on
service httpd start
mysqladmin -u root password ‘password’
创建一个 dashboard 数据库
1
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 << EOF
LoadModule 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 start
chkconfig httpd on
lokkit -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-dashboard
rake gems:refresh_specs
rake RAILS_ENV=production reports:import
Delayed Job Workers
env RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m start
ps -ef|grep delayed_job|grep -v grep
env RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 4 -m stop
这个时候你才能在 Dashbaord 里看到数据
6、安装 Foreman(待完善)
Puppet 学习系列:
Puppet 学习一:安装及简单实例应用 http://www.linuxidc.com/Linux/2013-08/88710.htm
Puppet 学习二: 简单模块配置和应用 http://www.linuxidc.com/Linux/2013-08/88711.htm
相关阅读:
有关 Puppet agent 端三种备份恢复方案探讨研究 http://www.linuxidc.com/Linux/2013-07/87885.htm
选择更安全的方式注册你的 Puppet 节点 http://www.linuxidc.com/Linux/2013-07/87884.htm
通过配置 SSH 深刻理解 Puppet 的语法及工作机制 http://www.linuxidc.com/Linux/2013-07/87882.htm
Puppet 利用 Nginx 多端口实现负载均衡 http://www.linuxidc.com/Linux/2013-02/79794.htm
Puppet 集中配置管理系统详解
CentOS(5 和 6)下 Puppet 的 C / S 模式实例 http://www.linuxidc.com/Linux/2011-12/50502.htm
Puppet 的详细介绍:请点这里
Puppet 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-08/122065.htm