Install Puppet in Linux
I. Prepare the environment
1. Set host name and hosts file
Master
Agent
2. Start the node ntpd service
3. Create a local yum Repository
See this link.
4. Set up an FTP server and provide a custom yum repository access interface
[root@master ~]# cat /etc/vsftpd/vsftpd.conflisten=YESanonymous_enable=YESlocal_enable=YESwrite_enable=YESlocal_umask=022anon_upload_enable=YESanon_mkdir_write_enable=YESanon_other_write_enable=YESdirmessage_enable=YESxferlog_enable=YESxferlog_file=/etc/vsftpd/vsftpd.logxferlog_std_format=YESftpd_banner=Welcome to Ftp(installed by DQ)pam_service_name=vsftpduserlist_enable=YEStcp_wrappers=YES
5. copy the generated yum source to the FTP shared directory.
[root@master ~]# cp -arv /home/puppet /var/ftp/pub/
6. configure remote yum repository on the agent
[root@agent ~]# cat /etc/yum.repos.d/puppet.repo [CentOS-puppet]name=puppetlabs epel gems for centosbaseurl=ftp://master.puppet.com/pub/puppet/enabled=1gpgcheck=0priority=1
Test whether puppet yum is available
- It indicates that puppet installation depends on ruby-shadow and ruby-augeas. ruby-related software packages are obtained through the EPEL source. However, you need to set the priority of the EPEL source on the Master and Agent to be lower than that of puppet, otherwise, puppet will obtain the upper and lower versions of EPEL for installation.
- Refer to step 3 to create the settings in the local yum repository.
Ii. install and configure puppet on the Master node yum
1. Install Puppet-server, puppet, and facter
[root@master ~]# yum install puppet puppet-server facter -y
2. Configure puppet. conf note: the configuration file contains two certnames. The certname configured in [master] is the master name used for all node authentication, and the certname configured in [agent] is the name of its own agent, of course, if this parameter is not set, it is the same as the master name by default.
[Root @ master ~] # Cp/etc/puppet. conf {,. bak} [root @ master ~] # Cat/etc/puppet. conf | grep "^ \ s * [^ # \ t]. * $ "[main] logdir =/var/log/puppet rundir =/var/run/puppet ssldir = $ vardir/ssl # certificate storage directory, by default, $ vardir is/var/lib/puppet [agent] classfile = $ vardir/classes.txt server = master.puppet.com # sets the name of the server on which the agent authenticates to the master, note that this name must be resolved by the node certname = agent.puppet.com # Set the agent certname localconfig = $ vardir/localconfig [master] certname = master.puppet.com # Set the puppetmaster authentication server name
3. Creating the site. pp file site. pp is the start of puppet reading all module pp files. It must be set before version 3.0; otherwise, the service cannot be started.
[root@master ~]# touch /etc/puppet/manifests/site.pp
4. Start the puppetmaster service.
[root@master ~]# /etc/init.d/puppetmaster startStarting puppetmaster: [ OK ]
5. Check the local certificate. The first time puppetmaster is started, the certificate is automatically generated and automatically registered.
[Root @ master ~] # Tree/var/lib/puppet/ssl // var/lib/puppet/ssl/── ca │ ├ ── ca_crl.pem │ ── ca_crt.pem │ ├ ── ca_key.pem │ ├ ── ca_pub.pem │ ── inventory.txt │ ── private │ └ ── ca. pass │ ── requests │ ── serial │ └ ── signed │ └ ── master.puppet.com. pem # registered ├ ── certificate_requests ── certs │ ── ca. pem │ ── master.puppet.com. pem ── crl. pem ├ ── private ├ ── private_keys │ └ ── master.puppet.com. pem └ ── public_keys ── master. pup Pet.com. pem9 directories, 13 files [root @ master ~] # Puppet cert -- list -- all + "master.puppet.com" # The belt + mark has been registered successfully (CF: 74: C7: C7: 91: DB: F5: 82: 3A: 5E: 01: 93: E8: 23: 64: C4) + (alt names: "DNS: master.puppet.com", "DNS: puppet", "DNS: puppet.puppet.com ")
6. Check the listening status. After the puppetmaster service is enabled, the TCP port 8140 is monitored by default.
Ii. install and configure puppet on the Agent yum
1. Install puppet and facter
[root@agent ~]# yum install puppet facter -y
2. Configure puppet. conf
3. The agent starts the node to initiate authentication to the master end in debug mode.
4. master-end authentication
[root@master ~]# puppet cert --list --all[root@master ~]# puppet cert --sign agent.puppet.com[root@master ~]# tree /var/lib/puppet/ssl/
Check the authentication status. The agent is not authenticated.
Register the agent
Check the authentication status again. The agent is authenticated.
Puppet Learning Series:
Puppet Learning 1: Installation and simple instance applications
Puppet 2: simple module configuration and application
Research on three Backup Recovery solutions for Puppet agent
Register your Puppet node in a safer way
Deep understanding of Puppet syntax and working mechanism through SSH Configuration
Puppet uses Nginx multiple ports for Load Balancing
C/S mode instance of Puppet in CentOS (5 and 6)
For more information about Puppet, click here.
Puppet: click here
This article permanently updates the link address: