First, view the official download source
Https://docs.puppet.com/guides/puppetlabs_package_repositories.html
Second, select the corresponding system download source
Since this machine is CentOS 7.1, choose Yum Source
https://yum.puppetlabs.com/
Third, installation puppet
# wget https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
# RPM-IVH puppetlabs-release-el-7.noarch.rpm
# yum Install Puppet-y
# puppet--version
3.8.7
Iv. introduction of puppet configuration file
The main configuration files of puppet are placed in the/etc/puppet directory, 3.8.7 has the following files
auth.conf Modules puppet.conf
which
Puppet.conf is the master daemon's main configuration file, which defines the running environment of master, initiates loading of files, and other information. The daemon is pre-checked against this file before it starts, as long as the preflight is successful
Daemon process.
Auth.conf is used primarily to define the agent's permissions to access the directory on master. If there is no permission control, the agent can access all resources on the master server.
Five, install Nginx package and start the Nginx service
Install the Nginx package, you can first generate the relevant template through the Puppet Resource command, and then edit it.
[[Email protected] ~]# Puppet Resource package Nginxpackage {'Nginx': Ensure='Absent',} [[Email protected]~]# Puppet Resource service Nginxservice {'Nginx': Ensure='stopped', enable='false',}
Where the Puppet resource package is the template that generates the installation packages, puppet Resource service is the template for the build service
Finally, the configuration file for the Nginx package is as follows:
' Nginx ' : ' present ' 'nginx': 'running ' ,}
Apply the configuration file locally
# Puppet Apply Nginx.pp
for inch inch 0.56 /stage[main]/main/package[nginx]/'stopped'running 'in5.76 seconds
See if the Nginx package is installed and the service is started
[Email protected] ~]# Rpm-qa |grepNginxnginx-1.6.3-9. El7.x86_64nginx-filesystem-1.6.3-9. El7.noarch[[email protected]~]#PS-ef |grepNginxroot3094 3070 0 -: -pts/2 xx:xx:xxtailf/var/log/nginx/Error.logroot3423 1 0 -: -?xx:xx:xxNginx:master process/usr/sbin/Nginxnginx3424 3423 0 -: -?xx:xx:xxNginx:worker Processnginx3425 3423 0 -: -?xx:xx:xxNginx:worker Processroot3432 1536 0 -: -pts/0 xx:xx:xx grep--color=auto Nginx
Puppet easy to get started