Puppet installation and deployment
Environment: CoentOS 5.8 x86_64, selinux, and iptables have disabled host planning:
- server.laoguang.me 192.168.12.117
- client.laoguang.me 192.168.12.161
1. Preparations before installation are required.1.1 hostname and IP ing write/etc/hosts
- echo "
- 192.168.12.117 server.laoguang.me server
- 192.168.12.161 client.laoguang.me client
- " >> /etc/hosts
-
- scp /etc/hosts client:/etc/
1.2 synchronization time, which is very important
- yum -y install ntp
- ntpdate ntp.api.bz
Ii. Install puppet2.1 software preparation
- Factor ## factor is a built-in tool provided by puppet to obtain client variables.
- 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
2.2 install ruby. Puppet is written in ruby.
- yum -y install ruby
2.3 install facter
- tar zxvf facter-1.6.4.tar.gz
- cd facter-1.6.4
- ruby install.rb
2.3 install Puppet
- cd ..
- tar zxvf puppet-2.7.6.tar.gz
- cd puppet-2.7.6
- ruby install.rb
2.4 Add puppet users
- useradd -s /sbin/nologin puppet
2.5 copy the required configuration file.
- 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
Iii. Configuration and Testing3.1 modify the configuration file server without modifying the client:
- Vim/etc/puppet. conf
-
- [Main]
- Logdir =/var/log/puppet
- Rundir =/var/run/puppet
- Ssldir = $ vardir/ssl
- [Agent]
- Classfile = $ vardir/classes.txt
- Serverserver = server. laoguang. me # define server
- Report = true # status report
- Runinterval = 180 # client Update Interval
- Localconfig = $ vardir/localconfig
3.2 Test the server front-end startup to facilitate viewing logs:
- puppet master --no-daemonize --debug --verbose
Client Verification:
- puppetd --test --server server.laoguang.me
Server to check whether a signature request is received:
- puppet cert --list
- client.laoguang.me (xx:xx:xx:xx:xx:xx:--)
The server signs the client
- puppet cert -s client.laoguang.me
The client obtains the server's configuration for the client and applies
- pupppet --test --server server.laoguang.me
Deployment is complete! Problems: 1. no puppet is added. server startup fails. 2. no synchronization time, no signature is allowed. After the synchronization time, delete all files under/var/lib/puppet/ssl/and verify again. The installation is relatively simple, the specific configuration in the future will be very complicated. Let's make it easy to update: deploy the puppet web Management page puppet-dashboard
4. Deploy the dashboard4.1 software preparation 1. ruby-enterprise-1.8.7 # compatibility issues with the 1.8.5 System
- wget http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
2. readline-devel # ruby dependency, which is not included in my source
- Wget ftp://rpmfind.net/linux/centos/5.9/ OS /i386/CentOS/readline-devel-5.1-3.el5.i386.rpm # x64 available
3. libtermcap-devel # readline-devel dependency
- wget ftp://rpmfind.net/linux/centos/5.8/os/x86_64/CentOS/libtermcap-devel-2.0.8-46.1.x86_64.rpm
4. puppet-dashboard-1.2.7 # what we want to install
- wget http://downloads.puppetlabs.com/dashboard/puppet-dashboard-1.2.7.tar.gz
4.2 install ruby-enterprise-1.87 first install the dependency package
- rpm -ivh libtermcap-devel-2.0.8-46.1.x86_64.rpm readline-devel-5.1-3.el5.i386.rpm
Unzip and install ruby
- 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 # change the installation directory
- <Enter>
Change environment variables:
- vim /etc/profile.d/ruby.sh
- export PATH=$PATH:/usr/local/ruby/bin
-
- . /etc/profile.d/ruby.sh
Add alias
- vim /root/.bashrc
- alias ruby='/usr/local/ruby/bin/ruby'
- . /root/.bashrc
View version
- 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
4.3 install other tools
- gem install ruby-mysql
- gem install rake
- gem install rails
4.4 install Mysql and Mysql-server
- yum -y install mysql-devel mysql mysql-server
Start Mysql
- service mysqld start
Create a database
- mysql
- mysql> create database dashboard default charset utf8;
- mysql> grant all on dashboard.* to 'dashboard'@'localhost' identified by 'redhat';
- mysql> flush privileges;
4.5 install dashboard
- tar xvf puppet-dashboard-1.2.7.tar.gz
- mv puppet-dashboard-1.2.7 /usr/local/puppet-dashboard
- cd /usr/local/puppet-dashboard
Edit configuration file
- Cp config/database. yml. example config/database. yml
- Vim config/database. yml
-
- Production:
- Database: dashboard
- Username: dashboard
- Password: "redhat"
- Encoding: utf8
- Adapter: mysql # If mysql-server is on another host, you can add host: Segment
Generate table
- Rake RAILS_ENV = production db: create # This may cause an error. The gem and rails versions may be incompatible,
I chose to downgrade the gem.
- Gem update -- system 1.5.3 # downgrade gem
Re-Execute
- Rake RAILS_ENV = production db: create # Run in/usr/local/puppet-dashboard
- Rake RAILS_ENV = production db: migrate
If the execution is normal, congratulations on starting dashboard
- /usr/local/puppet-dashboard/script/server -e production -d
- => Booting WEBrick
- => Rails 2.3.14 application starting on http://0.0.0.0:3000
Access http: // ip: 3000
650) this. width = 650; "src =" http://img1.51cto.com/attachment/201302/115554268.png "border =" 0 "alt =" "data-pinit =" registered "/>
This article from the "Free Linux, Share Linux" blog, please be sure to keep this source http://laoguang.blog.51cto.com/6013350/1130240