《puppet系统安装运维手册》由会员分享,可在线阅读,更多相关《puppet系统安装运维手册(11页珍藏版)》请在金锄头文库上搜索。
1、Puppet 系统安装运维手册1 安装配置 .11.1 版本信息 .11.2 服务器安装 .11.2.1 锁定 YUM 安装版本(如果需要安装旧版) .11.2.2 安装配置 Puppet-server.11.2.3 安装 Foreman.21.3 客户端安装 .52 管理服务 .52.1 Puppet-Server .52.2 Foreman .52.3 Foreman-Proxy .53 修改记录 .6第 1 页1 安装配置1.1 版本信息 操作系统: CentOS5.X 64bit1.2 服务器安装1.2.1 锁定 YUM 安装版本 (如果需要安装旧版)1.2.1.1 安装 yum-ve
2、rsionlockyum install yum-versionlock1.2.1.2 编辑/etc/yum/pluginconf.d/versionlock.listpuppet 2.7.20puppet-server 2.7.201.2.2 安装配置 Puppet-server1.2.2.1 安装rpm Uvh http:/dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpmrpm Uvh http:/ -y install gcc gcc-c+ libstdc+-develyum install puppe
3、t-server (旧版安装 yum install puppet-server-2.7.20)1.2.2.2 编辑/etc/puppet/ auth.confpath /runauth anymethod saveallow *1.2.2.3 增加/etc/puppet/ autosign.conf*1.2.2.4 编辑/etc/puppet/fileserver.conffilespath /var/lib/puppet/filesallow *1.2.2.5 编辑/etc/puppet/puppet.confmain# The Puppet log directory.第 2 页# Th
4、e default value is $vardir/log.logdir = /var/log/puppet# Where Puppet PID files are kept.# The default value is $vardir/run.rundir = /var/run/puppet# Where SSL certificates are kept.# The default value is $confdir/ssl.ssldir = $vardir/ssl vardir=/var/lib/puppetssldir=/var/lib/puppet/sslfactpath=/var
5、/lib/puppet/lib/factertemplatedir=/etc/puppet/templateshostcert = $vardir/ssl/certs/puppet.pemcertdir = $vardir/ssl/certsmasterreports = log,foremancertname=puppet-test-02 #服务器名 autosign=true autosign = /etc/puppet/autosign.conf1.2.2.6 修改/etc/hosts172.16.30.188 test-01 server #服务端 ip 地址,名称172.17.30.
6、xxx xxxx xxxx #客户端 ip 地址,名称1.2.3 安装 Foreman1.2.3.1 安装 Mysql-Serveryum install mysql-server mysqlchkconfig -add mysqldchkconfig -level 235 mysqld onservice mysqld start1.2.3.2 创建数据库mysql uroot pCREATE DATABASE foreman CHARACTER SET utf8;CREATE USER foremanlocalhost IDENTIFIED BY foreman;GRANT ALL PRI
7、VILEGES ON foreman.* TO foremanlocalhost;第 3 页1.2.3.3 安装 foremanrpm Uvh http:/yum.theforeman.org/releases/1.0/el5/foreman-release.rpmyum install postgresql-develyum install libvirt-develyum install foreman 修改/usr/share/foreman/config/ database.ymlproduction:adapter: mysqldatabase: foremanusername: f
8、oremanpassword: foremanencoding: utf8 将补丁复制到 usr/share/foreman/并替换相应文件vi /usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb# copy this file to your report dir - e.g. /usr/lib/ruby/1.8/puppet/reports/# add this report in your puppetmaster reports - e.g, in your puppet.conf add:# reports=log, forem
9、an # (or any other reports you want)# URL of your Foreman installation#$foreman_url=$foreman_url=http:/0.0.0.0:3000/require puppetrequire net/httprequire uriPuppet:Reports.register_report(:foreman) doPuppet.settings.use(:reporting)desc Sends reports directly to Foremandef processbeginuri = URI.parse
10、($foreman_url)http = Net:HTTP.new(uri.host, uri.port)if uri.scheme = https thenhttp.use_ssl = true第 4 页http.verify_mode = OpenSSL:SSL:VERIFY_NONEendreq = Net:HTTP:Post.new(/reports/create?format=yml)req.set_form_data(report = to_yaml)response = http.request(req)rescue Exception = eraise Puppet:Error
11、, Could not send report to Foreman at #$foreman_url/reports/create?format=yml: #eendendendcd /usr/share/foreman/bundle installbundle install -without development test postgresql libvirt sqlitegem install activerecord-mysql2-adapterRAILS_ENV=production rake db:migratescript/rails s -p 3000 -e product
12、ion -d 初始化 admin 口令cd /usr/share/foreman# RAILS_ENV=production rake permissions:reset编辑/usr/share/foreman/config/setting.yaml:puppet_server: #修改为你的 puppetmaster:login: false #改为 trueforeman web 打开 setting 那个页面,重启 foreman,进入 My account 修改密码1.2.3.4 安装 foreman-proxyyum install foreman-proxy编辑/etc/foreman-proxy/settings.yml:puppetca: true:puppet: true:puppet_conf: /etc/puppet/puppet.conf 修改 vis