Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows。
该工具使用python开发,小巧轻便(才15k行python代码),可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS,TFTP、RSYNC以及yum仓库、构造系统ISO镜像。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
Cobbler官网
组件 | 介绍 |
---|---|
distro | 表示一个发行版,用于标记一个发行版的最关键资源是kernel和ramdisk |
profile | 对于某一个特定的发行版(distro),加上kickstart文件,以及可能的存储库(repository)和一些内核参数,就是profile |
system | 对于某一个发行版(distro),使用一个特定的配置文件(profile)配置的一个或多个机器,就是system |
repository | 保存一个yum或rsync存储库的镜像信息 |
image | 可替换一个包含不属于此类别的文件的发行版对象(例如,无法分为kernel和initrd的对象) |
[root@localhost ~]$ cat /etc/redhat-release
CentOS release 6.10 (Final)
[root@localhost ~]$ setenforce 0
[root@localhost ~]$ service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@localhost ~]$ yum install python-devel python-devel gcc gcc-c++ automake autoconf ntpdate wget -y
[root@localhost ~]$ wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
注意:
虚拟机最好使用 (NAT)模式 ,因为稍后会搭建DHCP服务器在同一个局域网内有多个DHCP
服务器会起冲突,VMware NAT模式的DHCP服务也要关闭掉。
#一会安装Cobbler-web的时候会有一个依赖,先解决
Error: Package: cobbler-web-2.6.11-7.git95749a6.el6.noarch (epel)
Requires: Django >= 1.4
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@localhost ~]$ pip install --upgrade pip==9.0.3
#安装9.0.3版本pip
[root@localhost ~]$ pip install Django==1.4
#安装指定版本的Django框架
[root@localhost ~]$ yum install cobbler dhcp tftp-server pykickstart httpd -y
#安装Cobbler等所需服务
[root@localhost ~]$ wget https://mirrors.huaweicloud.com/epel/6/x86_64/Packages/c/cobbler-web-2.6.11-7.git95749a6.el6.noarch.rpm
#手动下载安装包
[root@localhost ~]$ rpm -ivh cobbler-web-2.6.11-7.git95749a6.el6.noarch.rpm --nodeps
[root@localhost ~]$ rpm -ql cobbler
/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/images # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror # yum源存储目录
/var/log/cobbler # 日志目录
/var/log/cobbler/install.log # 客户端系统安装日志
/var/log/cobbler/cobbler.log # cobbler日志
[root@localhost ~]$ sed -i "s/#ServerName www.example.com:80/ServerName 192.168.244.254/g" /etc/httpd/conf/httpd.conf
#替换成自己的IP或域名
[root@localhost ~]$ service httpd restart
[root@localhost ~]$ service cobblerd restart
[root@localhost ~]$ cobbler check
# 检测Cobbler的配置,如果看不到下面的结果,再次执行service cobblerd restart
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
https://github.com/cobbler/cobbler/wiki/Selinux
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : The default password used by the sample templates for 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
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
# 看着上面的检测结果一个一个解决
# 第1、2个问题,顺便修改其他功能
[root@localhost ~]$ sed -i 's/server: 127.0.0.1/server: 192.168.244.254/' /etc/cobbler/settings
#Cobbler服务器的IP
[root@localhost ~]$ sed -i 's/next_server: 127.0.0.1/next_server: 192.168.244.254/' /etc/cobbler/settings
#Cobbler DHCP服务器的IP
[root@localhost ~]$ sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
#使用Cobbler来管理DHCP服务
[root@localhost ~]$ sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
#防止循环安装系统,适用于服务器第一项启动项是PXE启动
# 第3个问题 关闭selinux
[root@localhost ~]$ vim /etc/sysconfig/selinux
SELINUX=disabled
#把enforcing更改成disabled
# 第4个问题 开启tftp
[root@localhost ~]$ vim /etc/xinetd.d/tftp
# 第5个问题
[root@localhost ~]$ cobbler get-loaders
# 自动从官网下载
[root@localhost ~]$ cd /var/lib/cobbler/loaders/
# 下载的内容
[root@localhost loaders]# ls
COPYING.elilo COPYING.yaboot grub-x86_64.efi menu.c32 README
COPYING.syslinux elilo-ia64.efi grub-x86.efi pxelinux.0 yaboot
# 第6个问题 开启rsync
[root@localhost ~]$ vim /etc/xinetd.d/rsync
disable = no
# 把yes改成no
# 第8个问题 设置新装系统的默认root密码123456
[root@localhost ~]$ vim /etc/cobbler/setting
default_password_crypted: "$1$hahaha$hSxFjZSHRoiEn4DYrrGUI."
#修改Cobbler的DHCP模板,不要直接修改DHCP本身的配置文件,因为cobbler会覆盖dhcp的配置文件
[root@localhost ~]$ vim /etc/cobbler/dhcp.template
#仅修改下面列出的字段
subnet 192.168.244.0 netmask 255.255.255.0 {
option routers 192.168.244.2;
option domain-name-servers 192.168.244.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.244.100 192.168.244.200;
[root@localhost ~]$ reboot
开机后执行
[root@localhost ~]$ service iptables stop
[root@localhost ~]$ service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@localhost ~]$ service cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
# 同步最新cobbler配置,它会根据配置自动修改dhcp/tftp等服务。
[root@localhost ~]$ cobbler sync
task started: 2018-11-27_065923_sync
task started (id=Sync, time=Tue Nov 27 06:59:23 2018)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
copying: /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
copying: /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
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 images
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 trigger cobbler.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@localhost ~]$ chkconfig httpd on
[root@localhost ~]$ chkconfig xinetd on
[root@localhost ~]$ chkconfig cobblerd on
[root@localhost ~]$ chkconfig dhcpd on
[root@localhost ~]$ /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@localhost ~]$ /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@localhost ~]$ /etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@localhost ~]$ /etc/init.d/dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
[root@localhost ~]$ cobbler
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...
[add|edit|copy|getks*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]
[root@localhost ~]$ cobbler import --help
Usage: cobbler [options]
Options:
-h, --help show this help message and exit
--arch=ARCH OS architecture being imported
--breed=BREED the breed being imported
--os-version=OS_VERSION
the version being imported
--path=PATH local path or rsync location
--name=NAME name, ex 'RHEL-5'
--available-as=AVAILABLE_AS
tree is here, don't mirror
--kickstart=KICKSTART_FILE
assign this kickstart file
--rsync-flags=RSYNC_FLAGS
pass additional flags to rsync
cobbler check 核对当前设置是否有问题
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的详细信息
cobbler sync 同步配置到数据目录,更改配置最好都要执行下
cobbler reposync 同步yum仓库
cobbler distro 查看导入的发行版系统信息
cobbler system 查看添加的系统信息
cobbler profile 查看配置信息
[root@localhost ~]$ wget https://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
#下载镜像
[root@localhost ~]$ mount -o loop,ro /root/CentOS-7-x86_64-DVD-1810.iso /mnt/
#挂载镜像
[root@localhost ~]$ cobbler import --path=/mnt/ --name=CentOS7-1810 --arch=x86_64
# --path 镜像路径
# --name 为安装源定义一个名字
# --arch 指定安装源是32位、64位、ia64, 目前支持的选项有: x86│x86_64│ia64
# 安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7.1-x86_64,如果重复,系统会提示导入失败。
[root@localhost ~]$ cobbler distro list
CentOS7-1810-x86_64
# 镜像存放目录,cobbler会将镜像中的所有安装文件拷贝到本地一份,放在/var/www/cobbler/ks_mirror下的CentOS7-1810-x86_64目录下。因此/var/www/cobbler目录必须具有足够容纳安装文件的空间。
[root@localhost ~]$ cd /var/www/cobbler/ks_mirror/
[root@localhost ks_mirror]# ls
CentOS7-1810-x86_64 config
[root@localhost ks_mirror]# ls CentOS7-1810-x86_64/
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages
repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
# Cobbler的ks.cfg文件存放位置
[root@localhost ks_mirror]# cd /var/lib/cobbler/kickstarts/
[root@localhost kickstarts]# ls
default.ks legacy.ks sample_esx4.ks sample_old.seed
esxi4-ks.cfg pxerescue.ks sample_esxi4.ks sample.seed
esxi5-ks.cfg sample_autoyast.xml sample_esxi5.ks
install_profiles sample_end.ks sample.ks
[root@localhost kickstarts]# vim CentOS7-1810-x86_64.cfg
#创建无人值守文件,把下面内容复制到文件中
# CentOS7-1810-x86_64.cfg的配置
# Cobbler for Kickstart Configurator for CentOS 7 by kongfanhe
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 2048
part swap --size 4096
part / --fstype xfs --size 1 --grow
firstboot --disable
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
@^minimal
@core
lrzsz.x86_64
nmap.x86_64
sysstat.x86_64
telnet.x86_64
vim-enhanced.x86_64
wget
%end
%post
# 在第一次导入系统镜像后,Cobbler会给镜像指定一个默认的kickstart自动安装文件在/var/lib/cobbler/kickstarts下的sample_end.ks。
[root@localhost kickstarts]# cobbler list
distros:
CentOS7-1810-x86_64
profiles:
CentOS7-1810-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
# 查看安装镜像文件信息
[root@localhost ~]$ cobbler distro report --name=CentOS7-1810-x86_64
Name : CentOS7-1810-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/CentOS7-1810-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/CentOS7-1810-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS7-1810-x86_64'}
Management Classes : []
OS Version : rhel6
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
# 查看所有的profile设置
[root@localhost ~]$ cobbler profile report
# 查看指定的profile设置
[root@localhost ~]$ cobbler profile report --name=CentOS7-1810-x86_64
Name : CentOS7-1810-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS7-1810-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks
#默认的ks文件
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
# 编辑profile,修改关联的ks文件
[root@localhost ~]$ cobbler profile edit --name=CentOS7-1810-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7-1810-x86_64.cfg
# 修改安装系统的内核参数,在CentOS7系统有一个地方变了,就是网卡名变成eno16777736这种形式,但是为了运维标准化,我们需要将它变成我们常用的eth0,因此使用下面的参数。但要注意是CentOS7才需要下面的步骤,CentOS6不需要。
[root@localhost ~]$ cobbler profile edit --name=Centos7-1810-x86_64 --kopts='net.ifname=s=0 biosdevname=0'
[root@localhost ~]$ cobbler profile report --name=CentOS7-1810-x86_64
Name : Centos7-1810-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS7-1810-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {'biosdevname': '0', 'net.ifname': 's=0'}
#内核参数修改
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/CentOS7-1810-x86_64.cfg
#已经修改成指定的ks文件
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
#每次修改都需要同步一次
[root@localhost ~]$ cobbler sync
如何修改启动菜单,把启动菜单上 官网地址 修改成自己的
[root@localhost ~]$ vim /etc/cobbler/pxe/pxedefault.template
MENU TITLE Cobbler | http://www.kongfanhe.com
[root@localhost ~]$ cobbler sync
#每次修改都需要同步
可能从学习kickstart开始就有人想怎样能够指定某台服务器使用指定ks文件,kickstart实现这功能可能比较复杂,但是Cobbler就很简单了。
区分一台服务器的最简单的方法就是物理MAC地址。
物理服务器的MAC地址在服务器上的标签上写了。
[root@localhost ~]$ cobbler system add --name=kongfanhe --mac=00:50:56:2F:71:41 --profile=Centos7-1810-x86_64 --ip-address=192.168.244.120 --subnet=255.255.255.0 --gateway=192.168.244.2 --interface=eth0 --static=1 --hostname=www.kongfanhe.com --name-servers="114.114.114.114 223.5.5.5"
[root@localhost ~]$ cobbler system list
kongfanhe
[root@localhost ~]$ cobbler sync
#我们已经安装了Cobbler-web
访问地址:http://192.168.244.254/cobbler_web
默认用户名:cobbler
默 认 密 码: cobbler
/etc/cobbler/users.conf # Web服务授权配置文件
/etc/cobbler/users.digest # 用于web访问的用户名密码配置文件
[root@localhost ~]$ cat /etc/cobbler/users.digest
cobbler:Cobbler:a2d6bae81669d707b72c0bd9806e01f3
# 设置Cobbler web用户登陆密码
# 在Cobbler组添加cobbler用户,提示输入2遍密码确认
[root@localhost ~]$ htdigest /etc/cobbler/users.digest "Cobbler" cobbler
Changing password for user cobbler in realm Cobbler
New password:
Re-type new password:
[root@localhost ~]$ cobbler sync
[root@localhost ~]$ service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@localhost ~]$ service cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
在次刷新界面重新登录,用新密码
[root@localhost ~]$ cobbler repo add --name=Ali --breed=yum --mirror=http://192.168.244.254/cobbler/ks_mirror/CentOS7-1810-x86_64/ --keep-updated=true
#mirror 指定你的镜像的路径
[root@localhost ~]$ cobbler reposync
#这个过程可能有点长
# Cobbler for Kickstart Configurator for CentOS 7 by clsn
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
$yum_repo_stanza
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 2048
part swap --size 4096
part / --fstype xfs --size 1 --grow
firstboot --disable
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
@^minimal
@core
vim-enhanced
wget
%end
%post
systemctl disable postfix.service
#$yum_config_stanza
https://www.cnblogs.com/pluse/p/8508538.html
应答文件保存为:Autounattend.xml
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>zh-CNUILanguage>
SetupUILanguage>
<InputLocale>zh-CNInputLocale>
<SystemLocale>zh-CNSystemLocale>
<UILanguage>zh-CNUILanguage>
<UILanguageFallback>UILanguageFallback>
<UserLocale>zh-CNUserLocale>
component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<ProductKey>
<Key>87VT2-FY2XW-F7K39-W3T8R-XMFGFKey>
ProductKey>
<AcceptEula>trueAcceptEula>
UserData>
<ImageInstall>
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/image/indexKey>
<Value>4Value>
MetaData>
InstallFrom>
<InstallTo>
<DiskID>0DiskID>
<PartitionID>1PartitionID>
InstallTo>
OSImage>
ImageInstall>
<DiskConfiguration>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1Order>
<Size>30000Size>
<Type>PrimaryType>
CreatePartition>
CreatePartitions>
<DiskID>0DiskID>
<WillWipeDisk>trueWillWipeDisk>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Extend>falseExtend>
<Active>trueActive>
<Format>NTFSFormat>
<Label>OSLabel>
<Letter>CLetter>
<Order>1Order>
<PartitionID>1PartitionID>
ModifyPartition>
ModifyPartitions>
Disk>
DiskConfiguration>
component>
settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>UABhAHMAcwB3AG8AcgBkAA==Value>
<PlainText>falsePlainText>
Password>
<DisplayName>北京爱匣子科技发展有限公司DisplayName>
<Group>AdministratorsGroup>
<Name>kfhName>
LocalAccount>
LocalAccounts>
UserAccounts>
<OOBE>
<NetworkLocation>WorkNetworkLocation>
<ProtectYourPC>3ProtectYourPC>
OOBE>
<TimeZone>China Standard TimeTimeZone>
component>
settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>*ComputerName>
component>
settings>
<cpi:offlineImage cpi:source="wim:j:/iso/cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408/sources/install.wim#Windows 7 ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
unattend>