Puppet的安装部署
- server.laoguang.me 192.168.12.117
- client.laoguang.me 192.168.12.161
- echo "
- 192.168.12.117 server.laoguang.me server
- 192.168.12.161 client.laoguang.me client
- " >> /etc/hosts
- scp /etc/hosts client:/etc/
- yum -y install ntp
- ntpdate ntp.api.bz
- factor ##factor是puppet提供内置工具,可以获取客户端的变量
- wget http://puppetlabs.com/downloads/facter/facter-1.6.7.tar.gz
- puppet
- wget http://puppetlabs.com/downloads/puppet/puppet-2.7.13.tar.gz
- yum -y install ruby
- tar zxvf facter-1.6.4.tar.gz
- cd facter-1.6.4
- ruby install.rb
- cd ..
- tar zxvf puppet-2.7.6.tar.gz
- cd puppet-2.7.6
- ruby install.rb
- useradd -s /sbin/nologin puppet
- cd conf/redhat/
- cp puppet.conf /etc/puppet/
- cp fileserver.conf /etc/puppet/
- cp logrotate /etc/puppet/
- cp server.sysconfig /etc/sysconfig/puppetmaster
- cp server.init /etc/init.d/puppetmaster
- vim /etc/puppet/puppet.conf
- [main]
- logdir = /var/log/puppet
- rundir = /var/run/puppet
- ssldir = $vardir/ssl
- [agent]
- classfile = $vardir/classes.txt
- serverserver = server.laoguang.me ##定义server
- report = true ##状态报告
- runinterval = 180 ##client更新时间间隔
- localconfig = $vardir/localconfig
- puppet master --no-daemonize --debug --verbose
- puppetd --test --server server.laoguang.me
- puppet cert --list
- client.laoguang.me (xx:xx:xx:xx:xx:xx:--)
- puppet cert -s client.laoguang.me
- pupppet --test --server server.laoguang.me
- wget http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
- wget ftp://rpmfind.net/linux/centos/5.9/os/i386/CentOS/readline-devel-5.1-3.el5.i386.rpm ##x64可用
- wget ftp://rpmfind.net/linux/centos/5.8/os/x86_64/CentOS/libtermcap-devel-2.0.8-46.1.x86_64.rpm
- wget http://downloads.puppetlabs.com/dashboard/puppet-dashboard-1.2.7.tar.gz
- rpm -ivh libtermcap-devel-2.0.8-46.1.x86_64.rpm readline-devel-5.1-3.el5.i386.rpm
- tar xvf ruby-enterprise-1.8.7-2012.02.tar.gz
- ruby-enterprise-1.8.7-2012.02
- ./installer
- <Enter>
- [/opt/ruby-enterprise-1.8.7-2012.02] : /usr/local/ruby ##更改安装目录
- <Enter>
- vim /etc/profile.d/ruby.sh
- export PATH=$PATH:/usr/local/ruby/bin
- . /etc/profile.d/ruby.sh
- vim /root/.bashrc
- alias ruby='/usr/local/ruby/bin/ruby'
- . /root/.bashrc
- ruby -v
- ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358)
- [x86_64-linux], MBARI 0x6770,Ruby Enterprise Edition 2012.02
- gem install ruby-mysql
- gem install rake
- gem install rails
- yum -y install mysql-devel mysql mysql-server
- service mysqld start
- mysql
- mysql> create database dashboard default charset utf8;
- mysql> grant all on dashboard.* to 'dashboard'@'localhost' identified by 'redhat';
- mysql> flush privileges;
- tar xvf puppet-dashboard-1.2.7.tar.gz
- mv puppet-dashboard-1.2.7 /usr/local/puppet-dashboard
- cd /usr/local/puppet-dashboard
- cp config/database.yml.example config/database.yml
- vim config/database.yml
- production:
- database: dashboard
- username: dashboard
- password: "redhat"
- encoding: utf8
- adapter: mysql #如果mysql-server在其它主机,可增加host:段
- rake RAILS_ENV=production db:create ##到这可能会报错,gem与rails的版本可能不兼容,
- gem update --system 1.5.3 ##降级gem
- rake RAILS_ENV=production db:create ##需在/usr/local/puppet-dashboard下运行
- rake RAILS_ENV=production db:migrate
- /usr/local/puppet-dashboard/script/server -e production -d
- => Booting WEBrick
- => Rails 2.3.14 application starting on http://0.0.0.0:3000