Skip to the content.

准备工作

[root@cobbler-server ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core)
root@cobbler-server ~]# cobbler version
Cobbler 2.8.3
  source: ?, ?
  build time: Mon May 28 12:41:53 2018
# 解压到/share/win7目录中
[root@cobbler-server win7]# pwd
/share/win7
[root@cobbler-server win7]# ls
autorun.inf  boot  bootmgr  bootmgr.efi  efi  setup.exe  sources  support  upgrade
[root@cobbler-server win7]# rpm -qa |grep wimtools
wimtools-1.9.2-1.el7.nux.x86_64
[root@cobbler-server win7]# mkwinpeimg 
You must specify the name of the image file to create!
Run "mkwinpeimg -h" to see usage information.
[root@cobbler-server win7]# ls -l Autounattend.xml 
-rw-r--r-- 1 root root 4634 Aug 26 22:54 Autounattend.xml

安装原理

安装步骤

1.准备PE镜像

[root@cobbler-server share]# vim install.cmd 
[root@cobbler-server share]# cat install.cmd 
wpeinit
net use z: \\192.168.56.173\share
z:
cd win7
setup.exe /unattend:Autounattend.xml
[root@cobbler-server share]# mkwinpeimg -W /share/win7/ -i -s install.cmd win7pe.iso
:: Copying primary boot files from mounted Windows ISO (/share/win7/)                         [DONE] 
:: Exporting image from "/share/win7//sources/boot.wim"                                       [BUSY] Using LZX compression with 1 thread
Archiving file data: 525 MiB of 525 MiB (100%) done
                                                                                              [DONE] 
:: Renaming setup.exe to prevent it from bothering us                                         [DONE] 
:: Setting "install.cmd" as the script to be executed when Windows PE boots                   [DONE] 
:: Rebuilding WIM with changes made                                                           [DONE] 
:: Making ISO image "win7pe.iso"                                                              [BUSY] Warning: creating filesystem that does not conform to ISO-9660.
                                                                                              [DONE] 
The image (win7pe.iso) is 208791552 bytes.
[root@cobbler-server share]# ls -l win7pe.iso 
-rw-r--r-- 1 root root 208791552 Sep  2 23:01 win7pe.iso

2.共享win7镜像

cobbler服务器上或者其他一个Linux服务器上安装samba服务,

yum install samba -y
systemctl enable smb

修改/etc/samba/smb.conf配置文件,本次配置使用cobbler服务器同时作为samba服务器

[global]
    log file = /var/log/samba/log.%m
    max log size = 5000
    security = user
    guest account = nobody
    map to guest = Bad User
    load printers = yes
    cups options = raw
[share]
	comment = winos
	path 	= /share
	directory mask 	= 0755
	create mask	= 0755
	guest ok	= yes
	writable	= yes

3.开始配置

cobbler distro add --name=windows7 --kernel=/var/lib/tftpboot/memdisk --initrd=/share/win7pe.iso --kopts="raw iso"
touch /var/lib/cobbler/kickstarts/win7pe.xml
cobbler profile add --name=windows7 --distro=windows7 --kickstart=/var/lib/cobbler/kickstarts/win7pe.xml
[root@cobbler-server ~]# cobbler distro list
   windows7
[root@cobbler-server ~]# cobbler distro report --name=windows7
Name                           : windows7
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : windows
Comment                        : 
Fetchable Files                : {}
Initrd                         : /share/test.iso
Kernel                         : /var/lib/tftpboot/memdisk
Kernel Options                 : {'raw': '~', 'iso': '~'}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {}
Management Classes             : []
OS Version                     : generic26
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}
[root@cobbler-server ~]# cobbler sync

参考