1. Puppet Introduction
Puppet is an Automated System Configuration tool developed based on the ruby language. It can run in C/S mode or independently and supports configuration management for all UNIX and Unix-like systems, the latest version also supports limited management of Windows operating systems. Puppet is suitable for the whole process of server management, such as initial installation, configuration update, and system deprecation.
Puppet is a configuration management tool for the Client/Server (C/S) architecture. Puppet-server (Puppet Master) is installed on the central server ), install puppet client on the target server to be managed ). After the client connects to the server, the configuration file defined on the server will be compiled and then run on the client. The client actively communicates with the server every half an hour to confirm the configuration information update. If there is a new configuration information (or the configuration changes ), the configuration file will be re-compiled and distributed to the client for execution. Of course, you can also manually trigger the update command on the server to force various clients to perform Configuration updates.
Ii. Installation of puppet
Puppet supports source code installation, yum installation, and Ruby gem installation. We recommend using Yum to install puppet on the official website for future upgrades, management, and maintenance. Centos can be installed using yum, but no puppet package exists in the default centos source. Therefore, you need to install the epel package first.
Epel is an extra packages for Enterprise Linux software package. It is created, maintained, and managed by a special interest group and is applicable to Red Hat Enterprise Linux (RHEL) A high-quality additional software package project with its derivative releases (such as centos and scientific Linux.
Install directly with an epel source (http://fedoraproject.org/wiki/EPEL/zh-cn) or puppetlabs source (http://yum.puppetlabs.com. Select the yum source of your system version.
Yum (all called Yellow Dog Updater, modified) is a shell front-end Package Manager in fedora, RedHat, Suse, and centos. Based on RPM package management, You can automatically download and install the RPM package from the specified server, automatically process dependencies, and install all dependent software packages at a time, you do not need to download and install it multiple times.
Installation environment:
uname -aLinux master.puppet.com 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
1. Master Installation
(1) Modify hosts (puppet requires that all machines have a complete domain name (FQDN). If no DNS server provides a domain name, you can set the host name on both machines.
(Note that you must first set the host name and then install puppet, because the host name is written to the certificate during puppet installation. This certificate is required for communication between the client and the server ):)
vim /etc/hosts192.168.0.110 master.puppet.com master192.168.0.111 client.puppet.com client
(2) install NTP to maintain Time Synchronization
#yum install ntp -y#ntpdate asia.pool.ntp.org#service ntpd start
(3) install Ruby
#yum install -y ruby ruby-libs ruby-shadow
(4) install puppet (3 methods)
1. Because puppet is not in the basic centos source, you need to add the official source provided by puppetlabs and install it directly.
# Wget http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-11.noarch.rpm
# Yum install puppetlabs-release-6-11.noarch.rpm
# Yum update
# Yum install-y puppet-server // install automatically installs the package on which puppet depends, including the facter
2. Configure the yum source according to the operating system version, the current system is centos6x64, so select the puppetlabs-release-6-11.noarch.rpm package. The configuration method is as follows:
# Rpm-uvh http://yum.puppetlabs.com/el/6Server/products/x86_64/puppetlabs-release-6-11.noarch.rpm#yum clean all # Yum install puppet-server // install automatically installs the package on which puppet depends (including facter)
3. Upgrade the yum source directly.
#rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm#yum install puppet-server
# Puppet -- version // check the version # facter -- version
We recommend that you use puppet master -- verbose -- no-daemonize to start the instance for the first time. This helps test and debug errors. If you use this method later, you can see the entire startup process, during the startup process, some initialization work will be done to create a local certificate authentication center, certificate and key for the master. Open the socket and wait for the client connection. You can view related files and directories in the/etc/puppet/SSL directory.
# Puppet master -- verbose -- no-daemonize // The first test to start the puppetmaster Service
# Server puppetmaster start // start the service
2. Client installation
(1) Modify hosts (puppet requires that all machines have a complete domain name (FQDN). If no DNS server provides a domain name, you can set the host name on both machines.
(Note that you must first set the host name and then install puppet, because the host name is written to the certificate during puppet installation. This certificate is required for communication between the client and the server ):)
vim /etc/hosts192.168.0.110 master.puppet.com master192.168.0.111 client.puppet.com client
(2) install NTP to maintain Time Synchronization
#yum install ntp -y#ntpdate asia.pool.ntp.org#service ntpd start
(3) install Ruby
#yum install -y ruby ruby-libs ruby-shadow#ruby --version
(4) install puppet (3 methods)
1. Because puppet is not in the basic centos source, you need to add the official source provided by puppetlabs and install it directly.
#wget http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-11.noarch.rpm #yum install puppetlabs-release-6-11.noarch.rpm #yum update#yum install -y puppet facter
2. Configure the yum source according to the operating system version, the current system is centos6x64, so select the puppetlabs-release-6-11.noarch.rpm package. The configuration method is as follows:
#rpm -Uvh http://yum.puppetlabs.com/el/6Server/products/x86_64/puppetlabs-release-6-11.noarch.rpm#yum clean all #yum install puppet facter
3. Upgrade the yum source directly.
#rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm#yum install puppet facter
# Puppet -- version // check the version # facter -- version # server puppet start // start the service
3. Simple puppet Configuration
(1) Client Configuration:
Add the following configuration under [Agent] of/etc/puppet. conf:
Server = master.puppet.com // master service address runinterval = 3600 // The interval at which automatic updates are performed, in seconds) listen = true // The client listens as a service, allows others to run and trigger puppet, and allows remote triggering of puppet node configuration
(2) The client generates the certificate:
The puppet client uses HTTPS to communicate with the server (master). To communicate with the server, a valid SSL certificate is generated and sent to the puppet server when the puppet client is run for the first time.
#puppet agent --no-daemonize --onetime --verbose --debug --server=master.puppet.com
(3) Master signature:
The puppet server must sign the client certificate to allow access to the client, after the signature is completed, you can use "puppet Cert list -- all" on the server to check that a + exists in front of master.puppet.com. This means that "join" is successful and both parties can communicate normally.
#puppet cert list --all"client.puppet.com" (SHA256) 27:D6:B6:2A:A7:F7:97:D7:1A:CD:C2:C5:33:6F:40:80:54:44:7D:F0:BA:08:07:A6:BA:C3:14:12:3C:3D:8B:1A+ "master.puppet.com" (SHA256) 46:0B:A6:93:8B:ED:0C:47:97:E8:A4:1C:9C:10:76:C8:91:3E:0F:A9:0A:F6:4C:24:00:9E:BD:4C:D7:22:1F:78 (alt names: "DNS:master.puppet.com", "DNS:puppet", "DNS:puppet.puppet.com")
This article from the "line --->" blog, please be sure to keep this source http://liumissyou.blog.51cto.com/4828343/1564853
Brief installation of puppet