防伪码:没有相当程度的孤独是不可能有内心的平和。
1、概述
本文部分图片源自网络,侵删。
1.1 介绍
官网地址 |
http://cobbler.github.io/ |
官网介绍:Cobbleris a Linux installation server that allows for rapid setup of networkinstallation environments. It glues together and automates many associatedLinux tasks so you do not have to hop between many various commands andapplications when deploying new systems, and, in some cases, changing existingones. Cobbler can help with provisioning, managing DNS and DHCP, packageupdates, power management, configuration management orchestration, and muchmore.
运维自动化包括标准化、工具化、Web化、服务化、智能化等几个不同的层级,在一家规模稍大、拥有服务器上千台甚至是几万台的生产环境中,想要真正实现运维自动化,工具化系统安装流程、统一系统安装规范,是其中最不能忽略的重要环节。普通的自动化部署可以采用pxe+dhcp+tftp配合kickstart实现,但是面对多版本、多部署需求的情况下,这种普通的部署方式可能达不到我们的要求;这时候就需要借助cobbler开源自动化部署工具来实现。
Cobbler是一个Linux服务器安装的服务(在经过调整也可以支持网络安装windows),用以自动化批量安装服务器系统,是当前自动化运维环境中不可或缺的工具。该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、yum仓库、构造系统ISO镜像。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。
Cobbler集成的服务:
PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
YUM仓库管理
TFTP(PXE启动时需要)
Apache(提供kickstart的安装源,并提供定制化的kickstart配置)
1.1.1 PXE概述
首先,要自动安装系统的机器,必须支持PXE,无论是有PXE的网卡或者芯片等(目前绝大部分的机器均支持)。
预启动执行环境(Preboot eXecution Environment,PXE,也被称为预执行环境)是让计算机通过网卡独立地使用数据设备(如硬盘)或者安装操作系统。PXE当初是作为Intel的有线管理体系的一部分,Intel和 Systemsoft于1999年9月20日公布其规格(版本2.1)。通过使用像网际协议(IP)、用户数据报协议(UDP)、动态主机设定协定(DHCP)、小型文件传输协议(TFTP)等几种网络协议和全局唯一标识符(GUID)、通用网络驱动接口(UNDI)、通用唯一识别码(UUID)的概念并通过对客户机(通过PXE自检的电脑)固件扩展预设的API来实现目的。PXE 客户机(client)这个术语是指机器在PXE启动过程中的角色。一个PXE 客户机(client)可以是一台服务器、桌面级电脑、笔记本电脑或者其他装有PXE启动代码的机器。
客户机的固件为接受到可用的PXE启动服务器,要在网络中尝试找出PXE重定向服务(DHCP代理)。在分析返回的包后,固件会向合适的启动服务器询问网络自检程序(NBP)的路径,并且通过TFTP协议下载到电脑的内存中,有可能会去校验它,最后执行它。当只有全部的PXE 客户机(client)只使用一个NBP时,全部的PXE 客户机可能会被指定是用BOOTP协议,从而不需要DHCP代理,但是仍然需要TFTP启动服务。
PXE 协议大致上结合了DHCP和TFTP,虽然都有在两者上面有改进。DHCP用于查找合适的启动服务器,TFTP用于下载初始引导程序和附加文件。为了开始一个PXE自检会话,PXE固件广播一个带有明确的PXE选项DHCPDISCOVER包(扩展DHCPDISCOVER)到67/UDP端口(DHCP服务器端口)。PXE选项是PXE固件有PXE能力的鉴定,但是会被一般的DHCP服务忽略。当固件受到从这样的服务受到DHCPOFFER包时,它会通过要求其提供配置信息来自我配置。
当 PXE 重定向服务 (DHCP代理) 收到一个 扩展DHCPDISCOVER 包时,它会通过发送一个带有明确的PXE选项DHCPDISCOVER包到PXE客户机的68/UDP端口 (DHCP 客户机端口)来回答。一个扩展DHCPDISCOVER包主要包含:
一个PXE发现控制领域,以决定是使用多播,广播(网路)或单播来联系PXE启动服务器。
一个列出可用的PXE启动服务器类型的地址表。
一个代表每个一个PXE启动服务器类型的条目单。
一个带有带有提示用户按下哪一个键来看到启动菜单的PXE启动菜单。
一个超过多长时间就启动第一启动菜单的超时数值。
一个DHCP代理服务可能在相同的主机上运行一个标准的DHCP服务器。尽管两个服务不可以共享67/UDP 端口,DHCP代理服务在4011/UDP 端口上运行,要求从客户端来的DHCPDISCOVER 包变成DHCPREQUEST 包。标准DHCP服务在其发送的DHCPOFFER 包中加入特殊的PXE 选项组合,这样PXE客户端知道可以在同一个主机的 4011/UDP 端口找到一个DHCP代理服务。
和一个正在启动系统的启动服务联系必须有一个IP地址(可能来自DHCP服务)。通过多播或单播一个带有特殊的PXE选项的 DHCPREQUEST 包(扩展DHCPREQUEST包)到 4011/UDP端口,或者广播(网路)这种包到 67/UDP端口。这种包包含有PXE启动服务类型和PXE启动层,一个守护进程允许运行多个启动服务类型。 一个扩展 DHCPREQUEST包可能是一个DHCPINFORM包。下面是PXE具体工作原理图,
简单总结一下:
PXE Client发送广播包请求DHCP分配IP地址DHCP;
Server回复请求,给出IP地址以及Boot;
Server的地址PXE下载引导文件执行引导程序;
1.1.2 KickStart概述
KickStart是一种无人职守安装方式。KickStart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg的文件;在其后的安装过程中(不只局限于生成KickStart安装文件的机器)当出现要求填写参数的情况时,安装程序会首先去查找KickStart生成的文件,当找到合适的参数时,就采用找到的参数,当没有找到合适的参数时,才需要安装者手工干预。这样,如果KickStart文件涵盖了安装过程中出现的所有需要填写的参数时,安装者完全可以只告诉安装程序从何处取ks.cfg(注:Cobbler一般使用.ks或.cfg文件)文件,然后去忙自己的事情。等安装完毕,安装程序会根据ks.cfg中设置的重启选项来重启系统,并结束安装。
工作原理大致如下:
cobbler是实现自动化安装操作系统的工具。它解决了PXE安装时的弊端(只能实现单一操作系统的安装)。实际上,cobbler是对PXE二次封装可实现多版本,多环境操作系统安装的高级抽象工具。
1.1.3 Cobbler概念和命令详解
概念 |
说明 |
发行版 |
表示一个操作系统。它承载了内核和 initrd 的信息,以及内核参数等其他数据。 |
配置文件 |
包含一个发行版、一个 kickstart 文件以及可能的存储库,还包含更多特定的内核参数等其他数据。 |
系统 |
表示要配给的机器。它包含一个配置文件或一个镜像,还包含 IP 和 MAC 地址、电源管理(地址、凭据、类型)以及更为专业的数据等信息。 |
存储库 |
保存一个 yum 或 rsync 存储库的镜像信息。 |
镜像 |
可替换一个包含不属于此类别的文件的发行版对象(例如,无法分为内核和 initrd 的对象)。 |
相关命令详解
命令名称 |
命令用途 |
cobbler check |
检查cobbler配置 |
cobbler list |
列出所有的cobbler元素 |
cobbler report |
列出元素的详细信息 |
cobbler distro |
查看导入的发行版系统信息 |
cobbler system |
查看添加的系统信息 |
cobbler profile |
查看配置信息 |
cobbler sync |
同步Cobbler配置,更改配置最好都要执行下 |
cobbler reposync |
同步yum仓库 |
cobbler distro add --name=string--kernel=path --initrd=path
[--kopts=string] [--kopts-post=string] [--ksmeta=string]
[--arch=x86|x86_64|ia64] [--breed=redhat|debian|suse]
[--template-files=string]
2、部署测试
2.1 环境准备
系统版本 |
CentOS 6.5 X64 Minimal |
主机IP |
192.168.10.5 |
网络环境 |
VMware NAT,静态,网关192.168.10.2 |
系统环境 |
硬盘250G,关闭SElinux、iptables,配置阿里云yum源 |
安装epel:
yum install -y http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
2.2 cobbler
yum安装Cobbler、DHCP、httpd等相关工具:
yum -y install cobbler cobbler-web dhcptftp-server pykickstart httpd
部分配置文件:
/etc/cobbler # 配置文件目录 /etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。 /etc/cobbler/dhcp.template # DHCP服务的配置模板 /etc/cobbler/tftpd.template # tftp服务的配置模板 /etc/cobbler/rsync.template # rsync服务的配置模板 /etc/cobbler/iso # iso模板配置文件目录 /etc/cobbler/pxe # pxe模板文件目录 /etc/cobbler/power # 电源的配置文件目录 /etc/cobbler/users.conf # Web服务授权配置文件 /etc/cobbler/users.digest # 用于web访问的用户名密码配置文件 /etc/cobbler/dnsmasq.template # DNS服务的配置模板 /etc/cobbler/modules.conf # Cobbler模块配置文件 /var/lib/cobbler # Cobbler数据目录 /var/lib/cobbler/config # 配置文件 /var/lib/cobbler/kickstarts # 默认存放kickstart文件 /var/lib/cobbler/loaders # 存放的各种引导程序 /var/www/cobbler # 系统安装镜像目录 /var/www/cobbler/ks_mirror # 导入的系统镜像列表 /var/www/cobbler/p_w_picpaths # 导入的系统镜像启动文件 /var/www/cobbler/repo_mirror # yum源存储目录 /var/log/cobbler # 日志目录 /var/log/cobbler/install.log # 客户端系统安装日志 /var/log/cobbler/cobbler.log # cobbler日志
2.3 配置Cobbler
启动httpd服务:
[root@Cobbler~]#/etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: httpd: apr_sockaddr_info_get() failedfor Cobbler httpd: Could not reliably determine the server's fullyqualified domain name, using 127.0.0.1 for ServerName [ OK ]
启动Cobbler:
[root@Cobbler~]#/etc/init.d/cobblerd start Starting cobbler daemon: [ OK ]
检查Cobbler的配置:
[root@Cobbler~]#cobbler check Traceback (most recent call last): File"/usr/bin/cobbler", line 36, insys.exit(app.main()) File"/usr/lib/python2.6/site-packages/cobbler/cli.py", line 657, in main rc =cli.run(sys.argv) File"/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run self.token =self.remote.login("", self.shared_secret) File "/usr/lib64/python2.6/xmlrpclib.py",line 1199, in __call__ returnself.__send(self.__name, args) File"/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File"/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request returnself._parse_response(h.getfile(), sock) File"/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response returnu.close() File"/usr/lib64/python2.6/xmlrpclib.py", line 838, in close raiseFault(**self._stack[0]) xmlrpclib.Fault: :'login failed'">
解决以上问题:
[root@Cobbler~]#/etc/init.d/cobblerd restart Stopping cobbler daemon: [ OK ] Starting cobbler daemon: [ OK ] [root@Cobbler~]#cobbler get-loaders task started: 2016-09-03_053311_get_loaders task started (id=Download Bootloader Content, time=SatSep 3 05:33:11 2016) downloading http://cobbler.github.io/loaders/README to/var/lib/cobbler/loaders/README downloadinghttp://cobbler.github.io/loaders/COPYING.elilo to/var/lib/cobbler/loaders/COPYING.elilo downloadinghttp://cobbler.github.io/loaders/COPYING.yaboot to/var/lib/cobbler/loaders/COPYING.yaboot downloading http://cobbler.github.io/loaders/COPYING.syslinuxto /var/lib/cobbler/loaders/COPYING.syslinux downloadinghttp://cobbler.github.io/loaders/elilo-3.8-ia64.efi to/var/lib/cobbler/loaders/elilo-ia64.efi downloadinghttp://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot downloadinghttp://cobbler.github.io/loaders/pxelinux.0-3.86 to/var/lib/cobbler/loaders/pxelinux.0 downloadinghttp://cobbler.github.io/loaders/menu.c32-3.86 to/var/lib/cobbler/loaders/menu.c32 downloadinghttp://cobbler.github.io/loaders/grub-0.97-x86.efi to/var/lib/cobbler/loaders/grub-x86.efi downloadinghttp://cobbler.github.io/loaders/grub-0.97-x86_64.efi to/var/lib/cobbler/loaders/grub-x86_64.efi *** TASK COMPLETE ***
再次检查:
[root@Cobbler~]#cobbler check The following are potential configuration items thatyou may want to fix: 1 : The 'server' field in /etc/cobbler/settings mustbe set to something other than localhost, or kickstarting features will notwork. This should be a resolvablehostname or IP for the boot server as reachable by all machines that will useit. 2 : For PXE to be functional, the 'next_server' fieldin /etc/cobbler/settings must be set to something other than 127.0.0.1, andshould match the IP of the boot server on the PXE network. 3 : change 'disable' to 'no' in /etc/xinetd.d/tftp 4 : change 'disable' to 'no' in /etc/xinetd.d/rsync 5 : file /etc/xinetd.d/rsync does not exist 6 : debmirror package is not installed, it will berequired to manage debian deployments and repositories 7 : The default password used by the sample templatesfor newly installed machines (default_password_crypted in/etc/cobbler/settings) is still set to 'cobbler' and should be changed, try:"openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'"to generate new one 8 : fencing tools were not found, and are required touse the (optional) power management features. install cman or fence-agents touse them Restart cobblerd and then run 'cobbler sync' to applychanges.
先备份配置文件:
[root@Cobbler~]#cp /etc/cobbler/settings /etc/cobbler/settings.bak
设置Cobbler服务器IP:
[root@Cobbler~]#sed -i 's/server: 127.0.0.1/server: 192.168.10.5/'/etc/cobbler/settings
设置next_server,作用和kickstart的类似,tftp的ip:
[root@Cobbler~]#sed -i 's/next_server: 127.0.0.1/next_server:192.168.10.5/' /etc/cobbler/settings
用Cobbler管理DHCP:
[root@Cobbler~]#sed -i 's/manage_dhcp:0/manage_dhcp: 1/' /etc/cobbler/settings
防止循环装系统,适用于服务器第一启动项是PXE启动:
[root@Cobbler~]#sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
设置新装系统的默认root密码123456。random-phrase-here为干扰码,可以自行设定:
[root@Cobbler ~]#openssl passwd -1 -salt 'test' '123456' $1$test$at615QShYKduQlx5z9Zm7/ [root@Cobbler ~]#vim /etc/cobbler/settings default_password_crypted: "$1$test$at615QShYKduQlx5z9Zm7/"
开启rsync,把disable的yes改为no:
[root@Cobbler ~]#vim /etc/xinetd.d/rsync servicersync { disable=no flags =IPv6 socket_type =stream wait =no user =root server =/usr/bin/rsync server_args =--daemon log_on_failure +=USERID } [root@Cobbler~]#/etc/init.d/xinetd restart Stopping xinetd: [FAILED] Starting xinetd: [ OK ]
配置DHCP模板:
[root@Cobbler ~]#vim /etc/cobbler/dhcp.template subnet 192.168.10.0 netmask 255.255.255.0 { optionrouters 192.168.10.2; optiondomain-name-servers 114.114.114.114; optionsubnet-mask 255.255.255.0; rangedynamic-bootp 192.168.10.60192.168.10.100; default-lease-time 21600; max-lease-time 43200; next-server $next_server;
配置详解:
subnet192.168.10.0 netmask 255.255.255.0:分配的ip地址所在的网段为192.168.10.0/24。 optionrouters:为客户端设定默认网关。 optiondomain-name-servers:客户端指明DNS服务器的IP地址。 optionsubnet-mask:客户端设定子网掩码。 range dynamic-bootp:分配的ip地址范围
同步Cobbler配置:
[root@Cobbler~]#cobbler sync task started: 2016-09-03_063123_sync task started (id=Sync, time=Sat Sep 3 06:31:23 2016) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/pxelinux.cfg/default removing: /var/lib/tftpboot/grub/p_w_picpaths removing: /var/lib/tftpboot/grub/grub-x86.efi removing: /var/lib/tftpboot/grub/grub-x86_64.efi removing: /var/lib/tftpboot/grub/efidefault removing: /var/lib/tftpboot/s390x/profile_list copying bootloaders trying hardlink /var/lib/cobbler/loaders/grub-x86.efi-> /var/lib/tftpboot/grub/grub-x86.efi trying hardlink/var/lib/cobbler/loaders/grub-x86_64.efi ->/var/lib/tftpboot/grub/grub-x86_64.efi copying distros to tftpboot copying p_w_picpaths generating PXE configuration files generating PXE menu structure rendering DHCP files generating /etc/dhcp/dhcpd.conf rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches running post-sync triggers running python triggers from/var/lib/cobbler/triggers/sync/post/* running python triggercobbler.modules.sync_post_restart_services running: dhcpd -t -q received on stdout: received on stderr: running: service dhcpd restart received on stdout: Starting dhcpd: [ OK ] received on stderr: running shell triggers from/var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.scm_track running shell triggers from/var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
设置开机启动:
[root@Cobbler~]#chkconfig httpd on [root@Cobbler~]#chkconfig xinetd on [root@Cobbler~]#chkconfig cobblerd on [root@Cobbler~]#/etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: httpd: apr_sockaddr_info_get() failedfor Cobbler httpd: Could not reliably determine the server's fullyqualified domain name, using 127.0.0.1 for ServerName [ OK ] [root@Cobbler~]#/etc/init.d/xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] [root@Cobbler~]#/etc/init.d/cobblerd restart Stopping cobbler daemon: [ OK ] Starting cobbler daemon: [ OK ] [root@Cobbler~]#/etc/init.d/dhcpd restart Shutting down dhcpd: [ OK ] Starting dhcpd:
编写Cobbler相关服务启动脚本:
[root@Cobbler ~]#vim /etc/init.d/cobbler #!/bin/bash # chkconfig: 345 80 90 # description:cobbler case\$1 in start) /etc/init.d/httpd start /etc/init.d/xinetd start /etc/init.d/dhcpd start /etc/init.d/cobblerd start ;; stop) /etc/init.d/httpd stop /etc/init.d/xinetd stop /etc/init.d/dhcpd stop /etc/init.d/cobblerd stop ;; restart) /etc/init.d/httpd restart /etc/init.d/xinetd restart /etc/init.d/dhcpd restart /etc/init.d/cobblerd restart ;; status) /etc/init.d/httpd status /etc/init.d/xinetd status /etc/init.d/dhcpd status /etc/init.d/cobblerdstatus ;; sync) cobbler sync ;; *) echo"Inputerror,please in put 'start|stop|restart|status|sync'!" exit2 ;; esac [root@Cobbler~]#chmod +x /etc/init.d/cobbler
2.4 导入镜像
在虚拟机上挂载CentOS6.5的镜像:
[root@Cobbler~]#mount /dev/cdrom /mnt mount: block device /dev/sr0 is write-protected,mounting read-only [root@Cobbler~]#cobbler import --path=/mnt/ --name=CentOS-6.5-x86_64--arch=x86_64 task started: 2016-09-03_065512_import task started (id=Media import, time=Sat Sep 3 06:55:12 2016) Found a candidate signature: breed=redhat,version=rhel6 Found a matching signature: breed=redhat,version=rhel6 Adding distros from path/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64: creating new distro: CentOS-6.5-x86_64 trying symlink:/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64 ->/var/www/cobbler/links/CentOS-6.5-x86_64 creating new profile: CentOS-6.5-x86_64 associating repos checking for rsync repo(s) checking for rhn repo(s) checking for yum repo(s) starting descent into /var/www/cobbler/ks_mirror/CentOS-6.5-x86_64for CentOS-6.5-x86_64 processing repo at :/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64 need to process repo/comps:/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64 looking for/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/repodata/*comps*.xml Keeping repodata as-is:/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/repodata *** TASK COMPLETE ***
查看镜像列表:
[root@Cobbler~]#cobbler distro list CentOS-6.5-x86_64
2.5 配置ks文件
创建CentOS6.5的ks文件:
[root@Cobbler ~]#cd /var/lib/cobbler/kickstarts/ [root@Cobbler kickstarts]#ls default.ks install_profiles sample_autoyast.xml sample_esxi4.ks sample_old.seed esxi4-ks.cfg legacy.ks sample_end.ks sample_esxi5.ks sample.seed esxi5-ks.cfg pxerescue.ks sample_esx4.ks sample.ks [root@Cobbler kickstarts]#vim CentOS-6.5-x86_64.ks # Cobbler for Kickstart Configurator for CentOS 6.5 byhdj #告知安装程序,这是一次全新安装,而不是升级upgrade。 install # 这些$开头的变量都是调用配置文件里的值。 url --url=$tree #使用文本模式安装。 text #设置在安装过程中使用的语言以及系统的缺省语言。 lang en_US.UTF-8 #设置系统键盘类型。 keyboard us #清除mbr引导信息。 zerombr #系统引导相关配置。 bootloader --location=mbr --driveorder=sda --append="crashkernel=autorhgb quiet" # Network information $SNIPPET('network_config') timezone --utc Asia/Shanghai authconfig --enableshadow --passalgo=sha512 rootpw --iscrypted $default_password_crypted clearpart --all --initlabel # CentOS6系统磁盘默认格式ext4。 #--grow告诉分区使用所有可用空间(若有),或使用设置的最大值。 #以MB为单位的分区最小值 part /boot --fstype ext4 --size=200 part swap --size=2048 part / --fstype ext4 --size=1 --grow firstboot --disable #关闭selinux。 selinux --disabled #关闭防火墙。 firewall --disabled #设置日志级别。 logging --level=info #设定安装完成后重启,此选项必须存在。 reboot %pre $SNIPPET('log_ks_pre') $SNIPPET('kickstart_start') $SNIPPET('pre_install_network_config') # Enable installation monitoring $SNIPPET('pre_anamon') %end #软件包 %packages @Base @Compatibility libraries @Debugging Tools @Development tools @Dial-up Networking Support @Hardware monitoring utilities @Performance Tools tree nmap sysstat lrzsz dos2unix telnet iptraf ncurses-devel openssl-devel zlib-devel OpenIPMI-tools screen %end %post %end
查看安装镜像文件信息:
[root@Cobblerkickstarts]#cobbler list distros: CentOS-6.5-x86_64 profiles: CentOS-6.5-x86_64 systems: repos: p_w_picpaths: mgmtclasses: packages: files: [root@Cobblerkickstarts]#cobbler distro report --name=CentOS-6.5-x86_64 Name : CentOS-6.5-x86_64 Architecture : x86_64 TFTP Boot Files : {} Breed : redhat Comment : Fetchable Files : {} Initrd :/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/p_w_picpaths/pxeboot/initrd.img Kernel :/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/p_w_picpaths/pxeboot/vmlinuz Kernel Options : {} Kernel Options (Post Install) : {} Kickstart Metadata : {'tree':'http://@@http_server@@/cblr/links/CentOS-6.5-x86_64'} Management Classes : [] OS Version : rhel6 Owners : ['admin'] Red Hat Management Key : <> Red Hat Management Server : < > Template Files : {}
同步cobbler:
[root@Cobblerkickstarts]#cobbler sync task started: 2016-09-03_210603_sync task started (id=Sync, time=Sat Sep 3 21:06:03 2016) running pre-sync triggers cleaning trees removing: /var/www/cobbler/p_w_picpaths/CentOS-6.5-x86_64 removing: /var/lib/tftpboot/pxelinux.cfg/default removing: /var/lib/tftpboot/grub/p_w_picpaths removing: /var/lib/tftpboot/grub/grub-x86.efi removing: /var/lib/tftpboot/grub/grub-x86_64.efi removing: /var/lib/tftpboot/grub/efidefault removing: /var/lib/tftpboot/p_w_picpaths/CentOS-6.5-x86_64 removing: /var/lib/tftpboot/s390x/profile_list copying bootloaders trying hardlink /var/lib/cobbler/loaders/grub-x86.efi-> /var/lib/tftpboot/grub/grub-x86.efi trying hardlink/var/lib/cobbler/loaders/grub-x86_64.efi ->/var/lib/tftpboot/grub/grub-x86_64.efi copying distros to tftpboot copying files for distro: CentOS-6.5-x86_64 trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/p_w_picpaths/pxeboot/vmlinuz -> /var/lib/tftpboot/p_w_picpaths/CentOS-6.5-x86_64/vmlinuz trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/p_w_picpaths/pxeboot/initrd.img ->/var/lib/tftpboot/p_w_picpaths/CentOS-6.5-x86_64/initrd.img copying p_w_picpaths generating PXE configuration files generating PXE menu structure copying files for distro: CentOS-6.5-x86_64 trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/p_w_picpaths/pxeboot/vmlinuz ->/var/www/cobbler/p_w_picpaths/CentOS-6.5-x86_64/vmlinuz trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64/p_w_picpaths/pxeboot/initrd.img ->/var/www/cobbler/p_w_picpaths/CentOS-6.5-x86_64/initrd.img Writing template files for CentOS-6.5-x86_64 rendering DHCP files generating /etc/dhcp/dhcpd.conf rendering TFTPD files generating /etc/xinetd.d/tftp processing boot_files for distro: CentOS-6.5-x86_64 cleaning link caches running post-sync triggers running python triggers from/var/lib/cobbler/triggers/sync/post/* running python triggercobbler.modules.sync_post_restart_services running: dhcpd -t -q received on stdout: received on stderr: running: service dhcpd restart received on stdout: Shutting down dhcpd: [ OK ] Starting dhcpd: [ OK ] received on stderr: running shell triggers from/var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.scm_track running shell triggers from/var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
3、验证
创建一台空虚拟机,复制其MAC地址:
--name 自定义,但不能重复:
[root@Cobblerkickstarts]#cobbler system add --name=test01--mac=00:50:56:37:C5:F7 --profile=CentOS-6.5-x86_64 --ip-address=192.168.10.60--subnet=255.255.255.0 --gateway=192.168.10.2 --interface=eth0 --static=1--hostname=test01 --name-servers="114.114.114.114"
开启空虚拟机电源,系统开始自动安装:
安装完成:
4、总结
本文只实验了一小部分功能,更多高级功能和特性待续。