Cobbler自动部署windows服务器

2020-04-24

Cobbler自动部署安装windows服务器

  1. 下载windows winpe和AIK工具

    下载地址

AIK安装只选部署工具就好

image-20200424172537453

  1. 创建windows自动应答文件

    []: https://www.windowsafg.com/win10x86_x64.html “在线创建windows自动安装应答文件”
    []: https://raw.githubusercontent.com/herbiel/shell-script/master/win10.xml “我自己的应答文件”

    也可以使用windows镜像部署工具自己创建

  2. 创建winpe镜像

    1
    2
    3
    4
    5
    6
    7
    8
    9
    copype amd64 E:\winpe

    Dism /mount-image /imagefile:E:\winpe\media\sources\boot.wim /index:1 /mountdir:E:\winpe\mount

    echo net use z: \\10.10.1.20\share >> E:\winpe\mount\Windows\System32\startnet.cmd
    echo z:\win\setup.exe /unattend:z:\win\win10.xml >> E:\winpe\mount\Windows\System32\startnet.cmd

    Dism /unmount-image /mountdir:E:\winpe\mount /commit
    MakeWinPEMedia /ISO E:\winpe E:\winpe\winpe10.iso

    10.10.1.20是smb服务器,也就是cobbler服务器

    win10.xml是自动应答文件

    然后把这个winpe10.iso 和win10.xml上传到cobbler服务器

  3. cobbler配置smb

    1
    yum install samba -y
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    [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 = share directory目录
    path = /smb/
    directory mask = 0755
    create mask = 0755
    guest ok=yes
    writable=yes
    1
    systemctl start smb
    1
    systemctl enable smb

    挂载windows iso镜像并复制到smb共享文件夹

    1
    mount -o loop,ro /home/work/cn_windows_10_business_editions_version_1809_updated_dec_2018_x64_dvd_f5563b4e.iso /mnt
    1
    2
    3
    4
    mkdir /smb/win
    cp -r /mnt/* /smb/win
    umount /mnt/
    cp /home/work/win10.xml /smb/win
  4. 创建cobbler profile和distro

    1
    cobbler distro add --name=windows_10_x64 --kernel=/var/lib/tftpboot/memdisk --initrd=/home/work/winpe10.iso --kopts="raw iso"
    1
    touch /var/lib/cobbler/kickstarts/winpe.xml
    1
    cobbler profile add --name=windows_10_x64 --distro=windows_10_x64 --kickstart=/var/lib/cobbler/kickstarts/winpe.xml
  5. 测试

    创建win虚拟机测试一下

    image-20200424173628854