我是007 发表于 2018-8-2 06:15:13

46 puppet master-agent模型、运维工具介绍及pxe环境的实现、cobbler简单实现、CentOS7 cobbler

  01puppet master-agent模型
  配置环境
  node1192.168.1.131CentOS7.2
  node2192.168.1.132CentOS7.2
  node3192.168.1.133CentOS7.2
  node4192.168.1.134CentOS7.2
  1、agent节点扩展为master节点
  # yum -y install puppet-server-3.8.4-1.el7.noarch.rpm
  # rpm -ql puppet-server
  /etc/puppet/environments
  /etc/puppet/environments/example_env
  /etc/puppet/environments/example_env/README.environment
  /etc/puppet/environments/example_env/manifests
  /etc/puppet/environments/example_env/modules
  /etc/puppet/fileserver.conf
  /etc/puppet/manifests
  /usr/lib/systemd/system/puppetmaster.service
  /usr/share/man/man8/puppet-ca.8.gz
  /usr/share/man/man8/puppet-master.8.gz
  # cd /etc/puppet
  # vim puppet.conf
  # cat /etc/hosts
  127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
  ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
  192.168.1.131   node1
  192.168.1.132   node2
  192.168.1.133   node3
  192.168.1.134   node4
  # puppet master -v --no-daemonize
  Info: Creating a new SSL key for ca
  Info: Creating a new SSL certificate request for ca
  Info: Certificate Request fingerprint (SHA256): 68:6E:25:1F:A2:C9:B9:25:D8:98:73:5E:2E:4B:8D:A9:D4:5C:30:DA:76:7E:55:0B:17:73:CC:56:CC:1D:CD:B1
  Notice: Signed certificate request for ca
  Info: Creating a new certificate revocation list
  Info: Creating a new SSL key for node2
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node2
  Info: Certificate Request fingerprint (SHA256): 6B:D9:38:9C:F6:85:A7:FC:82:8C:D5:59:FA:73:6E:B0:84:F5:C7:AA:B9:F5:B5:4D:75:04:22:1A:2B:7F:99:0E
  Notice: node2 has a waiting certificate request
  Notice: Signed certificate request for node2
  Notice: Removing file Puppet::SSL::CertificateRequest node2 at '/var/lib/puppet/ssl/ca/requests/node2.pem'
  Notice: Removing file Puppet::SSL::CertificateRequest node2 at '/var/lib/puppet/ssl/certificate_requests/node2.pem'
  Notice: Starting Puppet master version 3.8.4
  # ls /var/lib/puppet/ssl/
  ca                  certs    private       public_keys
  certificate_requestscrl.pemprivate_keys
  # rm -rf /var/lib/puppet/ssl/*
  #重新生成配置文件
  # puppet master -v --no-daemonize
  Info: Creating a new SSL key for ca
  Info: Creating a new SSL certificate request for ca
  Info: Certificate Request fingerprint (SHA256): F3:E1:22:ED:91:C4:40:C1:CF:03:70:2E:C8:95:00:72:39:9B:BF:AC:0F:B2:40:79:1E:ED:76:C1:09:A0:4D:2E
  Notice: Signed certificate request for ca
  Info: Creating a new certificate revocation list
  Info: Creating a new SSL key for node2
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node2
  Info: Certificate Request fingerprint (SHA256): 48:91:99:06:65:B4:29:5C:B4:14:EA:20:B2:53:D6:30:55:78:56:65:B1:99:DA:15:CB:66:28:60:20:E6:1D:87
  Notice: node2 has a waiting certificate request
  Notice: Signed certificate request for node2
  Notice: Removing file Puppet::SSL::CertificateRequest node2 at '/var/lib/puppet/ssl/ca/requests/node2.pem'
  Notice: Removing file Puppet::SSL::CertificateRequest node2 at '/var/lib/puppet/ssl/certificate_requests/node2.pem'
  Notice: Starting Puppet master version 3.8.4
  # ls /usr/lib/systemd/system/pupp*
  /usr/lib/systemd/system/puppetagent.service/usr/lib/systemd/system/puppetmaster.service/usr/lib/systemd/system/puppet.service
  # systemctl start puppetmaster.service
  #配置agent
  # rpm -ivh epel-release-latest-7.noarch.rpm
  # yum -y install facter-2.4.4-1.el7.x86_64.rpm puppet-3.8.4-1.el7.noarch.rpm
  # cd /etc/puppet/
  # puppet agent --server=node2 --no-daemonize --noop --test --verboseInfo: Creating a new SSL key for node3
  Info: Caching certificate for ca
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node3
  Info: Certificate Request fingerprint (SHA256): 70:FA:2D:17:6A:52:9F:EC:AE:7B:83:CD:F6:91:42:3D:4B:DE:79:61:7C:46:E4:D6:1E:65:4D:8F:8B:D0:A4:E1
  Info: Caching certificate for ca
  Exiting; no certificate found and waitforcert is disabled
  # puppet cert list
  "node3" (SHA256) 70:FA:2D:17:6A:52:9F:EC:AE:7B:83:CD:F6:91:42:3D:4B:DE:79:61:7C:46:E4:D6:1E:65:4D:8F:8B:D0:A4:E1
  # puppet cert sign node3
  Notice: Signed certificate request for node3
  Notice: Removing file Puppet::SSL::CertificateRequest node3 at '/var/lib/puppet/ssl/ca/requests/node3.pem'
  # puppet agent --server=node2 --no-daemonize --noop --test --verboseInfo: Creating a new SSL key for node3
  Info: Caching certificate for ca
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node3
  Info: Certificate Request fingerprint (SHA256): 70:FA:2D:17:6A:52:9F:EC:AE:7B:83:CD:F6:91:42:3D:4B:DE:79:61:7C:46:E4:D6:1E:65:4D:8F:8B:D0:A4:E1
  Info: Caching certificate for ca
  Exiting; no certificate found and waitforcert is disabled
  # puppet agent --server=node2 --no-daemonize--verboseInfo: Caching certificate for node3
  Info: Caching certificate_revocation_list for ca
  Info: Caching certificate for node3
  Notice: Starting Puppet client version 3.8.4
  Info: Retrieving pluginfacts
  Info: Retrieving plugin
  Info: Caching catalog for node3
  Info: Applying configuration version '1481204536'
  Info: Creating state file /var/lib/puppet/state/state.yaml
  Notice: Finished catalog run in 0.03 seconds
  #列出所有证书
  # puppet cert list --all
  + "node2" (SHA256) 2E:C8:71:41:A2:74:B9:41:20:85:30:7D:28:D2:5A:0D:4E:5C:CF:DD:54:F1:9F:82:C7:CB:1F:FD:42:31:91:81
  + "node3" (SHA256) EA:F3:56:95:E1:61:DD:63:B9:07:F0:0B:A9:CC:99:62:4C:1F:E1:7E:CF:83:1B:D7:B3:9A:B4:D9:B4:F5:27:8B
  #清除node3结点证书
  # puppet cert clean node3
  Notice: Revoked certificate with serial 3
  Notice: Removing file Puppet::SSL::Certificate node3 at '/var/lib/puppet/ssl/ca/signed/node3.pem'
  Notice: Removing file Puppet::SSL::Certificate node3 at '/var/lib/puppet/ssl/certs/node3.pem'
  # rm -f /var/run/puppet/agent.pid
  #重新签
  # puppet agent --server=node2 --no-daemonize --verbose
  Info: Creating a new SSL key for node3
  Info: Caching certificate for ca
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node3
  Info: Certificate Request fingerprint (SHA256): 27:C9:FD:B5:64:F9:B7:22:94:CD:84:0B:20:24:3F:55:3A:FB:AB:24:CD:8F:CB:A2:CD:B9:54:DC:EB:FB:E0:B1
  Info: Caching certificate for ca
  # puppet cert list
  "node3" (SHA256) 27:C9:FD:B5:64:F9:B7:22:94:CD:84:0B:20:24:3F:55:3A:FB:AB:24:CD:8F:CB:A2:CD:B9:54:DC:EB:FB:E0:B1
  # puppet cert sign node3
  Notice: Signed certificate request for node3
  Notice: Removing file Puppet::SSL::CertificateRequest node3 at '/var/lib/puppet/ssl/ca/requests/node3.pem'
  # cd manifests/
  # vim /etc/puppet/modules/nginx/mainfets/init.pp
  class nginx {
  package {'nginx':
  ensure=>latest,
  name    =>nginx,
  } ->
  service{'nginx':
  enable      =>true,
  ensure      =>running,
  hasrestart=>true,
  restart   =>'service nginx>
  }   
  }
  class nginx::webserver inherits nginx {
  file{'/etc/nginx/nginx.conf':
  source=> 'puppet:///modules/nginx/nginx_web.conf',
  ensure=>file,
  notify=>Service['nginx'],
  require =>Package['nginx'],
  }   
  }
  class nginx::proxy inherits nginx {
  file{'/etc/nginx/nginx.conf':
  content => template('nginx/nginx_proxy.conf.erb'),
  ensure=>file,
  notify=>Service['nginx'],
  require =>Package['nginx'],
  }   
  }
  # pwd
  /etc/puppet/manifests
  # vim site.pp
  node "node3" {
  include nginx::proxy
  }   
  # systemctl restart puppetmaster.service
  #puppet agent --server=node2 --no-daemonize --verbose
  Notice: Starting Puppet client version 3.8.4
  Info: Caching certificate_revocation_list for ca
  Info: Retrieving pluginfacts
  Info: Retrieving plugin
  Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find>
  Notice: Using cached catalog
  Info: Applying configuration version '1481204536'
  Notice: Finished catalog run in 0.04 seconds
  # systemctl start puppetagent.service
  02puppet master-agent模型
  # puppet config print environment
  production
  # vim autosign.conf
  *.magedu.com
  # systemctl restart puppetmaster.service
  #自动签署agent证书
  # rpm -ivh epel-release-latest-7.noarch.rpm
  # yum -y install facter-2.4.4-1.el7.x86_64.rpm puppet-3.8.4-1.el7.noarch.rpm
  # puppet agent --server=node2.magedu.com --noop --no-daemonize --verbose --test
  Info: Creating a new SSL key for node4
  Info: Caching certificate for ca
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node4
  Info: Certificate Request fingerprint (SHA256): 4B:CE:22:CB:18:E7:E3:0E:B9:A5:24:0B:21:76:92:AE:A7:19:D4:4A:B1:FE:88:28:D6:07:85:15:DD:72:E8:35
  Info: Caching certificate for ca
  Exiting; no certificate found and waitforcert is disabled
  # puppet cert list --all
  + "node2.magedu.com" (SHA256) 45:11:FF:B1:0D:D8:27:A9:A3:29:9C:BC:F6:B8:67:80:4E:81:9A:7D:18:90:EF:8E:5B:98:C9:67:44:DF:40:54 (alt names: "DNS:node2.magedu.com", "DNS:puppet", "DNS:puppet.magedu.com")
  + "node3.magedu.com"            (SHA256) BD:C3:B5:8B:3D:D5:56:FF:D7:A5:19:AD:47:E9:04:94:B9:D9:78:49:84:6E:E3:AB:AE:9C:5D:B4:8C:B8:F8:C2
  + "node4.magedu.com" (SHA256) 9A:87:F9:8F:EC:9E:00:ED:C7:13:7B:4C:14:4D:E5:6F:11:7B:E4:C8:54:C8:B8:18:39:75:27:19:3D:67:0D:D3
  # vim manifests/site.pp
  node "node3.magedu.com" {
  include nginx::proxy
  }
  node "node4.magedu.com" {
  }
  # systemctl restart puppetmaster.service
  # puppet agent --server=node2.magedu.com --noop --no-daemonize --verbose --test
  Info: Caching certificate for ca
  Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
  Info: Creating a new SSL certificate request for node4.magedu.com
  Info: Certificate Request fingerprint (SHA256): 4F:47:81:34:B7:66:24:80:81:EE:F0:7D:41:B8:D2:43:57:74:D4:A7:C9:87:6C:59:D4:63:98:B3:D4:49:0A:E8
  Info: Caching certificate for node4.magedu.com
  Info: Caching certificate_revocation_list for ca
  Info: Caching certificate for ca
  Info: Retrieving pluginfacts
  Info: Retrieving plugin
  Info: Caching catalog for node4.magedu.com
  Info: Applying configuration version '1481293129'
  Info: Creating state file /var/lib/puppet/state/state.yaml
  puppet kick模式
  # puppet agent --configprint environment
  production
  # puppet config print | grep listen
  listen = false
  # cd /etc/puppet/
  # vim puppet.conf
  末行添加
  listen = true
  # systemctl restart puppetagent.service
  # vim namespaceauth.conf
  
  allow node2.magedu.com
  # systemctl restart puppetagent.service
  # mkdir -p /etc/puppet/modules/varnish/{manifests,files,templates,lib,tests,spec}
  # vim /etc/puppet/modules/varnish/manifests/init.pp
  class varnish {
  package{'varnish':
  ensure=>latest,
  }   
  }   
  # vim /etc/puppet/manifests/site.pp
  node "node3.magedu.com" {
  include varnish
  include nginx::proxy
  }
  node "node4.magedu.com" {
  }
  # systemctl restart puppetmaster.service
  # vim auth.conf
  在倒数第四行# deny之前添加
  path /run
  method save
  allow node2.magedu.com
  # systemctl restart puppetagent.service
  # puppet kick node3.magedu.com
  Warning: Puppet kick is deprecated. See http://links.puppetlabs.com/puppet-kick-deprecation
  Warning: Failed to load ruby LDAP library. LDAP functionality will not be available
  Triggering node3.magedu.com
  Getting status
  status is success
  node3.magedu.com finished with exit code 0
  Finished
  # puppet apply -e 'include varnish' --noop -v
  Notice: Compiled catalog for node2.magedu.com in environment production in 0.95 seconds
  Info: Applying configuration version '1481332757'
  Notice: /Stage/Varnish/Package/ensure: current_value absent, should be latest (noop)
  Notice:>
  Notice: Stage: Would have triggered 'refresh' from 1 events
  Notice: Finished catalog run in 0.55 seconds
  # vim namespaceauth.conf
  
  allow node2.magedu.com
  # systemctl restart puppetagent.service
  
  03运维工具介绍及pxe环境的实现
  1、配置dhcp服务器
  环境配置:
  server:192.168.1.151 CentOS>
  eth0:192.168.1.151bridge
  eth1:vmnet2
  # yum install dhcp-y
  # ifconfig eth1 10.0.10.1/24 up
  # ifconfig
  eth0      Link encap:EthernetHWaddr 00:0C:29:06:DE:28
  inet addr:192.168.1.151Bcast:192.168.1.255Mask:255.255.255.0
  inet6 addr: fe80::20c:29ff:fe06:de28/64 Scope:Link
  UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
  RX packets:2712 errors:0 dropped:0 overruns:0 frame:0
  TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:295129 (288.2 KiB)TX bytes:12335 (12.0 KiB)
  eth1      Link encap:EthernetHWaddr 00:0C:29:06:DE:32
  inet addr:10.0.10.1Bcast:10.0.10.255Mask:255.255.255.0
  inet6 addr: fe80::20c:29ff:fe06:de32/64 Scope:Link
  UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:0 (0.0 b)TX bytes:468 (468.0 b)
  
  # cd /etc/dhcp/
  # cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample dhcpd.conf
  # vim dhcpd.conf
  option domain-name "magedu.com";
  option domain-name-servers 192.168.1.1;
  default-lease-time 43200;
  max-lease-time 86400;
  log-facility local7;
  subnet 10.0.10.0 netmask 255.255.255.0 {
  range 10.0.10.21 10.0.10.50;
  option routers 10.0.10.1;
  }
  # service dhcpd start
  查看客户端自动获得IP地址
  # tail /var/lib/dhcpd/dhcpd.leases
  server-duid "\000\001\000\001\037\336a\327\000\014)\006\3362";
  lease 10.0.10.21 {
  starts 6 2016/12/10 06:51:32;
  ends 6 2016/12/10 18:51:32;
  cltt 6 2016/12/10 06:51:32;
  binding state active;
  next binding state free;
  hardware ethernet 00:0c:29:bb:ea:bf;
  }
  为客户端分配指定IP地址:
  # vim dhcpd.conf
  添加
  host ftpserver {
  hardware ethernet 00:0c:29:bb:ea:bf;
  fixed-address 10.0.10.55;
  }
  # service dhcpd restart
  配置pxe
  1、dhcp
  # vim dhcpd.conf
  修改
  subnet 10.0.10.0 netmask 255.255.255.0 {
  range 10.0.10.21 10.0.10.50;
  option routers 10.0.10.1;
  }
  为
  subnet 10.0.10.0 netmask 255.255.255.0 {
  range 10.0.10.21 10.0.10.50;
  option routers 10.0.10.1;
  next-server 10.0.10.1;
  filename "pxelinux.0";
  }
  # service dhcpd restart
  
  2、tftp
  # yum -y install tftp-server tftp
  # chkconfig tftp on
  # service xinetd start
  # cp /etc/fstab /var/lib/tftpboot/
  # tftp 10.0.10.1
  # cd /var/lib/tftpboot/
  # yum -y install syslinux
  # cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
  # mount -r /dev/cdrom /mnt/
  # cd /mnt/isolinux/
  # ls
  boot.catgrub.conf   isolinux.binmemtest   TRANS.TBL   vmlinuz
  boot.msginitrd.imgisolinux.cfgsplash.jpgvesamenu.c32
  # cd ../images/pxeboot/
  # ls
  initrd.imgTRANS.TBLvmlinuz
  # cp vmlinuz initrd.img /var/lib/tftpboot/
  # cd ../../isolinux/
  # cp isolinux.cfg vesamenu.c32 splash.jpg boot.msg /var/lib/tftpboot/
  # mkdir /var/lib/tftpboot/pxelinux.cfg
  # cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/
  # cd /var/lib/tftpboot/pxelinux.cfg/
  # mv isolinux.cfg default
  # vim default
  修改
  menu>
  为
  menu>
  
  新建一个虚拟机,设置网卡为VMnet2
  # cd
  # yum -y install httpd
  # mkdir /var/www/html/centos6
  # umount /dev/cdrom
  # mount -r /dev/cdrom /var/www/html/centos6/
  # service httpd start
  安装模式选择“URL”,配置自动获得IP地址
  配置url地址为:http://10.0.10.1/centos6
  
  04cobbler简单实现
  1、cobbler安装
  # rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
  # yum -y install cobbler cobbler-web pykickstart debmirror httpd syslinux
  # cd /var/lib/tftpboot/
  # mkdir /root/pxeboot
  # mv ./* /root/pxeboot/
  # cd
  # vim /etc/dhcp/dhcpd.conf
  修改
  subnet 10.0.10.0 netmask 255.255.255.0 {
  range 10.0.10.21 10.0.10.50;
  option routers 10.0.10.1;
  next-server 10.0.10.1;
  filename "pxelinux.0";
  }
  为
  subnet 10.0.10.0 netmask 255.255.255.0 {
  range 10.0.10.21 10.0.10.50;
  option routers 10.0.10.1;
  filename "pxelinux.0";
  }
  # service dhcpd restart
  # service httpd start
  # service cobblerd start
  # cd /etc/cobbler/
  # openssl passwd -1 -salt `openssl rand -hex 4` #密码设为'magedu'
  Password:
  $1$f5673d2f$v4u767ixJnzbYp3XsW4.81
  # vim settings
  修改
  server: 127.0.0.1
  为
  server: 10.0.10.1
  修改
  next_server: 127.0.0.1
  为
  next_server: 10.0.10.1
  修改
  default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."
  为
  default_password_crypted: "$1$f5673d2f$v4u767ixJnzbYp3XsW4.81"#用上面生成的密码替换配置文件中的密码
  # service cobblerd restart
  # cobbler sync
  # cobbler repo help
  usage
  =====
  cobbler repo add
  cobbler repo copy
  cobbler repo edit
  cobbler repo find
  cobbler repo list
  cobbler repo remove
  cobbler repo rename
  cobbler repo report
  # umount /dev/cdrom
  # mount /dev/cdrom /media/ -r
  # cobbler import --path=/media/ --name=centos6.6-x86_64
  # cd /var/www/cobbler/ks_mirror/
  # ls
  centos6.6-x86_64config
  # cd centos6.6-x86_64/
  # ls
  CentOS_BuildTagisolinux                  RPM-GPG-KEY-CentOS-Debug-6
  EFI            Packages                  RPM-GPG-KEY-CentOS-Security-6
  EULA            >
  GPL            repodata                  TRANS.TBL
  images         RPM-GPG-KEY-CentOS-6
  # cd /etc/httpd/conf.d/
  # ls
  cobbler.confcobbler_web.confREADMEssl.confwelcome.confwsgi.conf
  # chkconfig rsync on
  # service xinetd restart
  # vim /etc/debmirror.conf
  修改
  @dists="sid";
  为
  #@dists="sid";
  修改
  @arches="i386";
  为
  #@arches="i386";
  
  # cobbler profile list
  centos6.6-x86_64
  # cobbler distro list
  centos6.6-x86_64
  # cobbler sync
  # service cobblerd restart
  启动测试客户端,可以正常安装操作系统
  2、新增一个kickstart安装项
  # cobbler profile help add
  usage
  =====
  cobbler profile add
  cobbler profile copy
  cobbler profile dumpvars
  cobbler profile edit
  cobbler profile find
  cobbler profile getks
  cobbler profile list
  cobbler profile remove
  cobbler profile rename
  cobbler profile report
  # vim centos6.x86_64.cfg #CentOS安装的kickstart文件
  # Kickstart file automatically generated by anaconda.
  #version=DEVEL
  install
  url --url="http://10.0.10.1/cobbler/ks_mirror/centos6.6-x86_64/"
  lang zh_CN.UTF-8
  keyboard us
  rootpw--iscrypted $6$dxqrElMVBdEAZWfC$dZOGcI8vfpUUMx.jsSh2BbCukKthMKnnKHs5GUGJTuzYgVx4ZFXIbigqg61xyiTId0XDqyqZ/kiX7hTnaEAzq0
  firewall --service=ssh
  authconfig --enableshadow --passalgo=sha512
  selinux --disable
  timezone --utc Asia/Shanghai
  bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
  # The following is the partition information you requested
  # Note that any partitions you deleted are not expressed
  # here so unless you clear all partitions first, this is
  # not guaranteed to work
  #clearpart --none
  #part /boot --fstype=ext4 --size=500
  #part swap --size=2000
  #part / --fstype=ext4 --grow --size=200
  repo --name="CentOS"--baseurl=cdrom:sr0 --cost=100
  %packages
  @base
  @chinese-support
  @core
  @debugging
  @basic-desktop
  @desktop-debugging
  @desktop-platform
  @directory-client
  @fonts
  @general-desktop
  @graphical-admin-tools
  @input-methods
  @internet-applications
  @internet-browser
  @java-platform
  @legacy-x
  @network-file-system-client
  @office-suite
  @print-client
  @remote-desktop-clients
  @server-platform
  @server-policy
  @workstation-policy
  @x11
  mtools
  pax
  oddjob
  wodim
  sgpio
  genisoimage
  device-mapper-persistent-data
  abrt-gui
  samba-winbind
  certmonger
  pam_krb5
  krb5-workstation
  libXmu
  %end
  # cp centos6.x86_64.cfg /var/lib/cobbler/kickstarts/
  # cobbler distro list
  centos6.6-x86_64
  # cobbler profile add --name "centos6.6-x86_64-web" --distro=centos6.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.x86_64.cfg
  # cobbler profile list
  centos6.6-x86_64
  centos6.6-x86_64-web
  # cobbler sync
  启动客户机测试,安装成功!
  
  3、cobbler_web
  1)生成cobbler登录账号、密码
  # cd /etc/cobbler/
  # htdigest /etc/cobbler/users.digest "Cobbler" cobbler
  Changing password for user cobbler in realm Cobbler
  New password:
  Re-type new password:
  #注:cobbler为登录账号,密码通过终端输入,这里为123456
  命令执行完成后生成users.digest文件
  # ll users.digest
  -rw-r--r-- 1 root root 49 Dec 11 09:51 users.digest
  # cobbler sync
  # service httpd restart
  # service cobblerd restart
  登录:http://192.168.1.151/cobbler_web(用户名cobbler,密码:123456)
  登录成功!
  05CentOS 7 cobbler
  配置环境:
  node1 192.168.1.131CentOS Linux>
  
  1、cobbler安装配置
  # rpm -ivh http://192.168.56.2/epel/epel-release-latest-7.noarch.rpm
  # yum install cobbler -y
  # systemctl start cobblerd.service
  # systemctl start httpd.service
  # openssl passwd -1 -salt $(openssl rand -hex 4)生成密码
  Password:
  $1$3cc52881$nUzvLXIkX6mXBytq/INg0/
  # vim /etc/cobbler/settings
  修改
  default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."
  为
  default_password_crypted: "$1$3cc52881$nUzvLXIkX6mXBytq/INg0/"#用上面生成的密码替换配置文件中的密码
  修改
  next_server: 127.0.0.1
  为
  next_server: 192.168.1.131
  修改
  server: 127.0.0.1
  为
  server: 192.168.1.131
  # yum -y install tftp-server tftp xinetd
  # chkconfig tftp on
  # vim /etc/xinetd.d/tftp
  修改
  disable         = yes
  为
  disable         = no
  # systemctl restart xinetd.service
  # systemctl start rsyncd.service
  # cobbler sync
  # systemctl restart cobblerd.service
  # cp /usr/share/syslinux/pxelinux.0 /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/
  # systemctl restart cobblerd.service
  # systemctl enable rsyncd.service
  # cobbler sync
  # yum -y install dhcp
  # cd /etc/dhcp/
  # cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example dhcpd.conf
  # vim dhcpd.conf
  option domain-name "magedu.com";
  option domain-name-servers 192.168.1.1;
  default-lease-time 600;
  max-lease-time 7200;
  log-facility local7;
  subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.10 192.168.1.20;
  option routers 192.168.1.1;
  next-server 192.168.1.131;
  filename "pxelinux.0";
  }
  # systemctl start dhcpd.service
  # cd
  # vim centos6.x86_64.cfg
  # Kickstart file automatically generated by anaconda.
  #version=DEVEL
  install
  url --url="http://192.168.1.131/cobbler/ks_mirror/centos6.6-x86_64/"
  lang zh_CN.UTF-8
  keyboard us
  rootpw--iscrypted $6$dxqrElMVBdEAZWfC$dZOGcI8vfpUUMx.jsSh2BbCukKthMKnnKHs5GUGJTuzYgVx4ZFXIbigqg61xyiTId0XDqyqZ/kiX7hTnaEAzq0
  firewall --service=ssh
  authconfig --enableshadow --passalgo=sha512
  selinux --disable
  timezone --utc Asia/Shanghai
  bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
  # The following is the partition information you requested
  # Note that any partitions you deleted are not expressed
  # here so unless you clear all partitions first, this is
  # not guaranteed to work
  #clearpart --none
  #part /boot --fstype=ext4 --size=500
  #part swap --size=2000
  #part / --fstype=ext4 --grow --size=200
  repo --name="CentOS"--baseurl=cdrom:sr0 --cost=100
  %packages
  @base
  @chinese-support
  @core
  @debugging
  @basic-desktop
  @desktop-debugging
  @desktop-platform
  @directory-client
  @fonts
  @general-desktop
  @graphical-admin-tools
  @input-methods
  @internet-applications
  @internet-browser
  @java-platform
  @legacy-x
  @network-file-system-client
  @office-suite
  @print-client
  @remote-desktop-clients
  @server-platform
  @server-policy
  @workstation-policy
  @x11
  lftp
  %end
  在光驱插入CentOS6.7光盘
  # mount -r /dev/sr0 /mnt/
  # ls /mnt/
  CentOS_BuildTagisolinux                  RPM-GPG-KEY-CentOS-Debug-6
  EFI            Packages                  RPM-GPG-KEY-CentOS-Security-6
  EULA            >
  GPL            repodata                  TRANS.TBL
  images         RPM-GPG-KEY-CentOS-6
  # mv centos6.x86_64.cfg /var/lib/cobbler/kickstarts/
  # cobbler import --path=/mnt --name="CentOS-6.7-x86_64" --kickstart=/var/lib/cobbler/kickstarts/centos6.x86_64.cfg
  # ls /var/www/cobbler/ks_mirror/CentOS-6.7-x86_64/#上面创建的文件在此处
  CentOS_BuildTagisolinux                  RPM-GPG-KEY-CentOS-Debug-6
  EFI            Packages                  RPM-GPG-KEY-CentOS-Security-6
  EULA            >
  GPL            repodata                  TRANS.TBL
  images         RPM-GPG-KEY-CentOS-6
  # cobbler distro list
  CentOS-6.7-x86_64
  # cobbler profile list
  CentOS-6.7-x86_64   
  # cobbler sync
  # vim /var/lib/tftpboot/pxelinux.cfg/default
  上面生成的文件如下:
  LABEL CentOS-6.7-x86_64
  kernel /images/CentOS-6.7-x86_64/vmlinuz
  MENU LABEL CentOS-6.7-x86_64
  append initrd=/images/CentOS-6.7-x86_64/initrd.img ksdevice=bootif lang=kssendmac textks=http://192.168.1.131/cblr/svc/op/ks/profile/CentOS-6.7-x86_64
  # vim /var/lib/cobbler/kickstarts/centos6.x86_64.cfg
  修改
  url --url="http://192.168.1.131/cobbler/ks_mirror/centos6.6-x86_64/"
  为
  url --url="http://192.168.1.131/cobbler/ks_mirror/centos-6.7-x86_64/"
  默认yum源保存位置:
  # ls /var/www/cobbler/ks_mirror/
  CentOS-6.7-x86_64config
  # cobbler profile list
  CentOS-6.7-x86_64
  # cobbler profile remove --name=CentOS-6.7-x86_64
  # cobbler profile add --name=CentOS-6.7-x86_64 --distro=CentOS-6.7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.x86_64.cfg
  # cobbler sync
  创建一个新的虚拟机,进行测试
  2、安装配置cobbler-web
  # yum -y install cobbler-web
  # cd /etc/cobbler/
  #生成认证用户密码(用户名:cblradmin,密码:123456)
  # htdigest /etc/cobbler/users.digest Cobbler cblradmin
  Adding user cblradmin in realm Cobbler
  New password:
  Re-type new password:
  # systemctl restart httpd.service
  登录网址:
  https://192.168.1.131/cobbler_web
页: [1]
查看完整版本: 46 puppet master-agent模型、运维工具介绍及pxe环境的实现、cobbler简单实现、CentOS7 cobbler