一、查看官方提供的下载源

https://docs.puppet.com/guides/puppetlabs_package_repositories.html

二、 选择对应系统的下载源

因为本机是CentOS 7.1,故选择YUM源

https://yum.puppetlabs.com/

三、 安装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

四、 Puppet配置文件介绍

Puppet的主配置文件均放到/etc/puppet目录下,3.8.7版本有以下几个文件

auth.conf  modules  puppet.conf

其中:

puppet.conf是Master守护进程的主配置文件,定义了Master的运行环境,启动加载文件等信息。守护进程在启动前会根据这个文件进行预检,只要预检成功才能启动

守护进程。

auth.conf主要用来定义Agent访问Master上目录的权限。如果没有权限控制的话,Agent可以访问Master服务器上的所有资源。

五、 安装nginx包并启动nginx服务

安装nginx包,可先通过puppet resource命令生成相关的模板,然后再对其进行编辑。

[root@master1 ~]# puppet resource package nginx
package { 'nginx':
ensure => 'absent',
}
[root@master1 ~]# puppet resource service nginx
service { 'nginx':
ensure => 'stopped',
enable => 'false',
}

其中,puppet resource package是生成安装包的模板,puppet resource service是生成服务的模板

最后,nginx包的配置文件如下:

package { 'nginx':
ensure => 'present',
}
service { 'nginx':
ensure => 'running',
}

在本地应用该配置文件

# puppet apply nginx.pp

Notice: Compiled catalog for master1.localdomain in environment production in 0.56 seconds
Notice: /Stage[main]/Main/Package[nginx]/ensure: created
Notice: /Stage[main]/Main/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
Notice: Finished catalog run in 5.76 seconds

查看nginx包是否安装以及服务是否启动

[root@master1 ~]# rpm -qa |grep nginx
nginx-1.6.-.el7.x86_64
nginx-filesystem-1.6.-.el7.noarch
[root@master1 ~]# ps -ef |grep nginx
root : pts/ :: tailf /var/log/nginx/error.log
root : ? :: nginx: master process /usr/sbin/nginx
nginx : ? :: nginx: worker process
nginx : ? :: nginx: worker process
root : pts/ :: grep --color=auto nginx

Puppet简易入门的更多相关文章

  1. 机器学习简易入门(四)- logistic回归

    摘要:使用logistic回归来预测某个人的入学申请是否会被接受 声明:(本文的内容非原创,但经过本人翻译和总结而来,转载请注明出处) 本文内容来源:https://www.dataquest.io/ ...

  2. Pandas简易入门(二)

    目录:     处理缺失数据     制作透视图     删除含空数据的行和列     多行索引     使用apply函数   本节主要介绍如何处理缺失的数据,可以参考原文:https://www. ...

  3. 不用搭环境的10分钟AngularJS指令简易入门01(含例子)

    不用搭环境的10分钟AngularJS指令简易入门01(含例子) `#不用搭环境系列AngularJS教程01,前端新手也可以轻松入坑~阅读本文大概需要10分钟~` AngularJS的指令是一大特色 ...

  4. Web压力测试工具 LoadRunner12.x简易入门教程--(一)回放与录制

        LoadRunner12.x简易入门教程--(一)回放与录制 今天在这里分享一下LoadRunner12.x版本的入门使用方法,希望对刚接触LoadRunner的童鞋有所帮助. LoadRun ...

  5. JNI简易入门

    JNI简介 JNI(Java Native Interface)是JDK的一部分,提供了若干API实现了Java和其他语言的通信(主要是C/C++).JNI主要用于以下场景: 贴近硬件底层的功能,Ja ...

  6. crontab简易入门

    前言 crontab是Unix和Linux用于设置周期性被执行的指令,是互联网很常用的技术,很多任务都会设置在crontab循环执行,如果不使用crontab,那么任务就是常驻程序,这对你的程序要求比 ...

  7. Golang项目的配置管理——Viper简易入门配置

    Golang项目的配置管理--Viper简易入门配置 What is Viper? From:https://github.com/spf13/viper Viper is a complete co ...

  8. MyCAT简易入门

    MyCAT是mysql中间件,前身是阿里大名鼎鼎的Cobar,Cobar在开源了一段时间后,不了了之.于是MyCAT扛起了这面大旗,在大数据时代,其重要性愈发彰显.这篇文章主要是MyCAT的入门部署. ...

  9. T-SQL语句简易入门(第一课)

    在微软官方,有一篇介绍T-SQL语句的教程,非常好理解,完全可以帮助新手入门,了解常用SQL语句的使用语法,而且又不涉及较为复杂的操作.不用安装示例数据库AdventureWorks.下面是教程里内容 ...

随机推荐

  1. 自定义 TableViewCell 的分割线

    刚开始自定义 tableViewCell 的时候,用的是直接在 cell 上加一张 imageView 的方法,如果在点击 cell 的时候有页面的跳转,这样做没什么问题,但是,如果在点击 cell ...

  2. Apache error: 403 Forbidden You don't have permission to access

    CentOS 6 solution: chcon -t httpd_sys_content_t -R /directory refer to: https://www.centos.org/forum ...

  3. python 通用 修饰器

    import functools def log(option): def dec(func): def swapper(*arg, **karg): functools.update_wrapper ...

  4. Devexpress Ribbon

    http://www.cnblogs.com/liwei81730/archive/2011/12/21/2296203.html 可查看此处.

  5. Vuforia点击屏幕自动对焦,过滤UGUI的按钮

    //点击屏幕自对对焦 #if UNITY_EDITOR )) #elif UNITY_ANDROID || UNITY_IPHONE && Input.GetTouch().phase ...

  6. Comparing the MSTest and Nunit Frameworks

    I haven't seen much information online comparing the similarities and differences between the Nunit ...

  7. git配置ssh(github)

    [参考官方文档] SSH keys are a way to identify trusted computers, without involving passwords. The steps be ...

  8. Eclipse自动生成作者、日期注释等功能设置

    我们在使用Eclipse 编写Java代码时,自动生成的注释信息都是按照预先设置好的格式生成的. 修改作者.日期注释格式:打开Windows->Preferences->Java-> ...

  9. AFNetWorking

    目录: 1.为什么要用AFNetworking 2.AFNetworking的用法 一.为什么要用AFNetworking 在ios开发中,一般情况下,简单的向某个web站点简单的页面提交请求并获取服 ...

  10. ESENT分布式数据存储

    关于ESENT,我能想到最恰当的比喻是,它是Microsoft世界的BerkeleyDB,鲜为人知,很少有.NET开发人员使用它,rhino-queues项目使用就是它,但它的性能和可靠性已经经受住了 ...