目标

管理一个局域网,网络内的电脑配置不一,安装系统是个很烦人的活儿。以前一直用 Windows Server 的部署服务 WDS 来给客户机安装系统,也尝试在 WDS 中添加 pxe Ubuntu Live CD 的引导。但是 Windows Server 启动太慢了,占用资源也多,近期把 Windows Server 换成了 Ubuntu。

ISC-DHCP-SERVER

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#allow booting;
allow bootp;option domain-name "linux";
option domain-name-servers 111.11.11.1;
option option-128 code 128=string;
option option-128 code 129=text;
option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;option architecture-type code 93 = unsigned integer 16;option space ipxe;
option ipxe-encap-opts code 175 = encapsulate ipxe;
option ipxe.priority code 1 = signed integer 8;
option ipxe.keep-san code 8 = unsigned integer 8;
option ipxe.skip-san-boot code 9 = unsigned integer 8;
option ipxe.syslogs code 85 = string;
option ipxe.cert code 91 = string;
option ipxe.privkey code 92 = string;
option ipxe.crosscert code 93 = string;
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
option ipxe.bus-id code 177 = string;
option ipxe.san-filename code 188 = string;
option ipxe.bios-drive code 189 = unsigned integer 8;
option ipxe.username code 190 = string;
option ipxe.password code 191 = string;
option ipxe.reverse-username code 192 = string;
option ipxe.reverse-password code 193 = string;
option ipxe.version code 235 = string;
option iscsi-initiator-iqn code 203 = string;
# Feature indicators
option ipxe.pxeext code 16 = unsigned integer 8;
option ipxe.iscsi code 17 = unsigned integer 8;
option ipxe.aoe code 18 = unsigned integer 8;
option ipxe.http code 19 = unsigned integer 8;
option ipxe.https code 20 = unsigned integer 8;
option ipxe.tftp code 21 = unsigned integer 8;
option ipxe.ftp code 22 = unsigned integer 8;
option ipxe.dns code 23 = unsigned integer 8;
option ipxe.bzimage code 24 = unsigned integer 8;
option ipxe.multiboot code 25 = unsigned integer 8;
option ipxe.slam code 26 = unsigned integer 8;
option ipxe.srp code 27 = unsigned integer 8;
option ipxe.nbi code 32 = unsigned integer 8;
option ipxe.pxe code 33 = unsigned integer 8;
option ipxe.elf code 34 = unsigned integer 8;
option ipxe.comboot code 35 = unsigned integer 8;
option ipxe.efi code 36 = unsigned integer 8;
option ipxe.fcoe code 37 = unsigned integer 8;
option ipxe.vlan code 38 = unsigned integer 8;
option ipxe.menu code 39 = unsigned integer 8;
option ipxe.sdi code 40 = unsigned integer 8;
option ipxe.nfs code 41 = unsigned integer 8;option client-architecture code 93 = unsigned integer 16;option ipxe.no-pxedhcp 1;default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
log-facility local7;
option ip-forwarding true;
option mask-supplier false;subnet 192.168.14.0 netmask 255.255.255.0 {authoritative;range 192.168.14.12 192.168.14.252;option domain-name-servers 111.11.11.1;default-lease-time 600;max-lease-time 7200;option broadcast-address 192.168.14.255;option routers 192.168.14.1;ping-check true;# DHCP option 60 PXEClient#option vendor-class-identifier "PXEClient";option vendor-encapsulated-options 01:04:00:00:00:00:ff;class "pxeclient" {match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";# For iPXE Boot filesif exists user-class and option user-class = "iPXE" {if option client-architecture = encode-int ( 16, 16 ) {option vendor-class-identifier "HTTPClient";filename "http://192.168.14.195/ipxe/ipxe.efi";} else {filename "http://192.168.14.195/ipxe/menu.ipxe";}} elsif option client-architecture = 00:00 {filename "undionly.kpxe"; # for booting legacy PXE} else {filename "ipxe.efi";      # for booting UFEI PXE}}next-server 192.168.14.195;host music1{hardware ethernet 00:00:00:d1:00:00;fixed-address 192.168.14.3;}
}

Apache2

lonely@lonely-Ubuntu:/srv/www$ tree -L 3
.
├── ipxe
│   ├── gparted-live.ipxe
│   ├── memdisk
│   ├── menu.ipxe
│   ├── ubuntu-live.ipxe
│   ├── ubuntu-live-nfs.ipxe
│   ├── wimboot
│   ├── winpe-amd64.ipxe
│   └── winpe-x86.ipxe
├── linux
│   ├── gparted
│   │   ├── filesystem.squashfs
│   │   ├── initrd.img
│   │   └── vmlinuz
│   ├── gparted-live-1.2.0-1-amd64.iso
│   ├── gparted-live-1.2.0-1-i686.iso
│   ├── hirsute-desktop-amd64.iso
│   ├── memdisk
│   └── ubuntu
│       ├── boot
│       ├── boot.catalog
│       ├── casper
│       ├── dists
│       ├── EFI
│       ├── install
│       ├── md5sum.txt
│       ├── pool
│       ├── preseed
│       └── ubuntu
├── tools
│   ├── ChromeSetup.exe
│   ├── Dism++10.1.1001.10_d4ba4eb035254b3326d6adc6638bc9c8daea7018.zip
│   ├── Firefox Setup 87.0.exe
│   ├── QQPinyin_Setup_6.6.6304.400.exe
│   ├── QQWubi_Setup_2.3.622.400.exe
│   ├── sogou_pinyin_102a.exe
│   ├── SPlayer-Setup-4.9.4.exe
│   ├── sysdiag-full-5.0.59.0-20210411.exe
│   └── weasel-0.14.3.0-installer.exe
└── winpe├── amd64│   ├── fwfiles│   ├── media│   └── mount├── LICENSE.txt├── README.txt├── src│   ├── assert.h│   ├── bootapp.h│   ├── byteswap.h│   ├── callback.S│   ├── cmdline.c│   ├── cmdline.h│   ├── compiler.h│   ├── coverity-model.c│   ├── cpio.c│   ├── cpio.h│   ├── ctype.h│   ├── die.c│   ├── efi│   ├── efiblock.c│   ├── efiblock.h│   ├── efiboot.c│   ├── efiboot.h│   ├── efi.c│   ├── efifile.c│   ├── efifile.h│   ├── efiguid.c│   ├── efi.h│   ├── efimain.c│   ├── efipath.c│   ├── efipath.h│   ├── efireloc.c│   ├── errno.h│   ├── huffman.c│   ├── huffman.h│   ├── i386.i│   ├── int13.c│   ├── int13.h│   ├── ipxe│   ├── lznt1.c│   ├── lznt1.h│   ├── lzx.c│   ├── lzx.h│   ├── main.c│   ├── Makefile│   ├── pause.c│   ├── pause.h│   ├── peloader.c│   ├── peloader.h│   ├── prefix.S│   ├── rotate.h│   ├── script.lds│   ├── sha1.c│   ├── sha1.h│   ├── startup.S│   ├── stdarg.h│   ├── stddef.h│   ├── stdint.h│   ├── stdio.c│   ├── stdio.h│   ├── stdlib.h│   ├── string.c│   ├── string.h│   ├── strings.h│   ├── vdisk.c│   ├── vdisk.h│   ├── vsprintf.c│   ├── wchar.h│   ├── wctype.h│   ├── wimboot.h│   ├── wimboot.i386│   ├── wimboot.x86_64│   ├── wim.c│   ├── wimfile.c│   ├── wimfile.h│   ├── wim.h│   ├── wimpatch.c│   ├── wimpatch.h│   ├── x86_64.i│   ├── xca.c│   └── xca.h└── x86├── fwfiles├── media└── mount25 directories, 101 files

NFS

lonely@lonely-Ubuntu:/etc/ganesha$ cat ganesha.conf
###################################################
#
# Ganesha Config Example
#
# This is a commented example configuration file for Ganesha.  It is not
# complete, but only has some common configuration options.  See the man pages
# for complete documentation.
#
##################################################### These are core parameters that affect Ganesha as a whole.
NFS_CORE_PARAM {## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4,## instead of using the physical paths.mount_path_pseudo = true;## Configure the protocols that Ganesha will listen for.  This is a hard## limit, as this list determines which sockets are opened.  This list## can be restricted per export, but cannot be expanded.#Protocols = 3,4,9P;
}## These are defaults for exports.  They can be overridden per-export.
EXPORT_DEFAULTS {## Access type for clients.  Default is None, so some access must be## given either here or in the export itself.Access_Type = RW;
}## Configure settings for the object handle cache
MDCACHE {## The point at which object cache entries will start being reused.Entries_HWMark = 100000;
}## Configure an export for some file tree
EXPORT
{## Export Id (mandatory, each EXPORT must have a unique Export_Id)Export_Id = 46;## Exported path (mandatory)Path = /srv/nfs/ubuntu;## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)Pseudo = /ubuntu;## Restrict the protocols that may use this export.  This cannot allow## access that is denied in NFS_CORE_PARAM.#Protocols = 3,4;## Access type for clients.  Default is None, so some access must be## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT blockAccess_Type = RW;## Whether to squash various users.Squash = no_root_squash;## Allowed security types for this export#Sectype = sys,krb5,krb5i,krb5p;## Exporting FSALFSAL {Name = VFS;}
}## Configure an export for some file tree
EXPORT
{## Export Id (mandatory, each EXPORT must have a unique Export_Id)Export_Id = 28;## Exported path (mandatory)Path = /srv/lonely;## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)Pseudo = /lonely;## Restrict the protocols that may use this export.  This cannot allow## access that is denied in NFS_CORE_PARAM.#Protocols = 3,4;## Access type for clients.  Default is None, so some access must be## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT blockAccess_Type = RW;## Whether to squash various users.Squash = no_root_squash;## Allowed security types for this export#Sectype = sys,krb5,krb5i,krb5p;## Exporting FSALFSAL {Name = VFS;}
}## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## configured from the command line
LOG {## Default log level for all componentsDefault_Log_Level = WARN;## Configure per-component log levels.Components {FSAL = INFO;NFS4 = EVENT;}## Where to logFacility {name = FILE;destination = "/var/log/ganesha.log";enable = active;}
}

nfs directory

sudo mount -o loop /srv/www/linux/hirsute-desktop-amd64.iso /mnt
sudo cp -a -r -v /mnt/. /srv/nfs/ubuntu/
showmount -e

menu.ipxe

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat menu.ipxe
#!ipxeset menu-timeout 5000
set submenu-timeout ${menu-timeout}:start
menu iPXE boot menu
item --gap --             Welcome to use iPXE network boot system!
item --gap --             ------------------------- Operating systems ------------------------------
item --key w menu-winpe     Windows Preinstallation Environment...
item --key l menu-live      Linux Live Environments...
item --key b salstar        Chain http://boot.salstar.sk
item --gap --             ------------------------- Advanced options -------------------------------
item --key c config       Configure settings
item shell                Drop to iPXE shell
item reboot               Reboot computer
item
item --key x exit         Exit iPXE and continue BIOS boot
choose --timeout ${menu-timeout} --default menu-winpe selected || goto cancel
set menu-timeout 0
goto ${selected}:menu-winpe
menu Windows Preinstallation environments
item winpe-x86       Boot Windows Preinstallation environments x86
item winpe-amd64       Boot Windows Preinstallation environments x64
item
item --key 0x08 back      Back to top menu...
choose --timeout ${submenu-timeout} --default winpe-amd64 selected && goto ${selected} || goto start:menu-live
menu Linux Live Environments
item ubuntu-live          Boot Ubuntu LiveCD from http
item ubuntu-live-nfs      Boot Ubuntu LiveCD from nfs
item gparted-live         Boot Gparted LiveCD
item
item --key 0x08 back      Back to top menu...
choose --timeout ${submenu-timeout} --default ubuntu-live selected && goto ${selected} || goto start:salstar
chain http://boot.salstar.sk:ubuntu-live
chain ubuntu-live.ipxe:ubuntu-live-nfs
chain ubuntu-live-nfs.ipxe:gparted-live
chain gparted-live.ipxe:winpe-x86
chain winpe-x86.ipxe:winpe-amd64
chain winpe-amd64.ipxe:pxelinux
echo Loading pxelinux ...
set next-server 192.168.14.195
set 209:string pxelinux.cfg/default
set 210:string tftp://${next-server}/
kernel ${url}pxelinux.0
boot:cancel
echo You cancelled the menu, dropping you to a shell:shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start:failed
echo Booting failed, dropping to shell
goto shell:reboot
reboot:exit
exit:config
config
goto start:back
set submenu-timeout 0
goto start

ipxe directory

lonely@lonely-Ubuntu:/srv/www/ipxe$ ls
gparted-live.ipxe  menu.ipxe         ubuntu-live-nfs.ipxe  winpe-amd64.ipxe
memdisk            ubuntu-live.ipxe  wimboot               winpe-x86.ipxe

configuration file

ipxe boot ubuntu live cd from nfs

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat ubuntu-live-nfs.ipxe
#!ipxeset server_ip 192.168.14.195
set nfs_path /ubuntu
kernel http://192.168.14.195/linux/ubuntu/casper/vmlinuz
initrd http://192.168.14.195/linux/ubuntu/casper/initrd
imgargs vmlinuz initrd=initrd boot=casper netboot=nfs ip=dhcp nfsroot=${server_ip}:${nfs_path} nosplash --
boot

ipxe boot ubuntu live cd from http

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat ubuntu-live.ipxe
#!ipxe# See http://manpages.ubuntu.com/manpages/precise/man7/casper.7.html for casper cmdline details
echo Booting Ubuntu Live for education
kernel http://192.168.14.195/linux/ubuntu/casper/vmlinuz
initrd http://192.168.14.195/linux/ubuntu/casper/initrd
imgargs vmlinuz initrd=initrd root=/dev/ram0 ip=dhcp url=http://192.168.14.195/linux/hirsute-desktop-amd64.iso splash --
boot

ipxe boot winpe x32

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat winpe-x86.ipxe
#!ipxekernel wimboot
set arch x86
initrd http://192.168.14.195/winpe/${arch}/media/Boot/BCD                     BCD
initrd http://192.168.14.195/winpe/${arch}/media/Boot/boot.sdi                boot.sdi
initrd http://192.168.14.195/winpe/${arch}/media/sources/boot.wim             boot.wim
boot

ipxe boot winpe x64

lonely@lonely-Ubuntu:/srv/www/ipxe$ cat winpe-amd64.ipxe
#!ipxekernel wimboot
set arch amd64
initrd http://192.168.14.195/winpe/${arch}/media/Boot/BCD                     BCD
initrd http://192.168.14.195/winpe/${arch}/media/Boot/boot.sdi                boot.sdi
initrd http://192.168.14.195/winpe/${arch}/media/sources/boot.wim             boot.wim
boot

PXE 网络安装 windows 或 linux相关推荐

  1. u盘启动pxe安装linux,U盘启动安装centos5.5+centos6.3+PXE网络安装CentOS

    此U盘启动安装盘的功能: 1.0pe可用来进行系统维护: 2.0pe可安装windows 2003原版系统: 3.0pe可作为pxe服务器进行网络安装,加上http服务器软件可提供网络安装CentOS ...

  2. 如何在CentOS 5.x 中安装Windows Azure Linux Agent (WALA)

    Qing Liu  Tue, Mar 10 2015 3:06 AM 在今天的这一个章节中,我们主要讨论在CentOs 5.x 中如何安装Windows Azure Linux Agent 2.11 ...

  3. pxe网络安装操作系统 原理与详细过程

    1.操作系统安装的流程 通用流程:首先,bios启动,选择操作系统的启动(安装)模式(此时,内存是空白的),然后根据相关的安装模式,寻找操作系统的引导程序(不同的模式,对应不同的引导程序当然也对应着不 ...

  4. 通过pxe远程安装linux,通过PXE远程安装多台Linux系统

    通过PXE远程安装多台Linux系统 实验目的:同时安装多台服务器,如果一台一台装的话会吐血的,出于节省时间的考虑,选用PXE的方式. 实验环境: 服务器CentOS5.1 VM虚拟机N台(如果是给实 ...

  5. 通信服务器系统安装,pxe网络安装操作系统

    PXE 技术简单说就是利用网卡上的PXE BootROM(自启动芯片)截取系统引导控制权,并通过DHCP指定的TFTP服务下载系统启动所需的镜像文件.BootROM目前是通用网卡默认的硬件固件,此技术 ...

  6. deepin安装tftp服务器_用PXE网络安装Deepin 20系统的设置:可同时安装多台机器

    以下是使用PXE网络安装Deepin 20系统的设置方案,利于该安装方法可以同时安装多台机器,它是大规模安装深度Deepin机器的首选方案.该方法使用Dnsmasq,它是一个轻量的域名解析,DHCP服 ...

  7. PXE网络安装已经无人值守安装教程

    PXE网络安装与Kickstart(无人值守)安装教程 PXE是由Intel公司开发的网络引导技术,工作在Client/Server模式中,允许客户机通过网络从远程服务器下载引导镜像,并加载安装文件或 ...

  8. 如何安装windows和linux双操作系统?

    如何安装windows和linux双操作系统? 一.win压缩卷: 1.右键此电脑,选择管理,选择磁盘管理. 2.挑选一个磁盘然后右击选择压缩卷,空间大小自己确定. 二.下载复刻工具和iso光盘映像文 ...

  9. 硬盘第一个基本分区c 的 ntfs格式的XP上 安装 windows和linux 双引导 设置grub(安装WINGRUB),

    硬盘第一个基本分区c 的 ntfs格式的XP上 安装 windows和linux 双引导 设置grub(安装WINGRUB), 以红旗 ( 奥运版)linux 为例 NTFS上安装grub 本文经过实 ...

最新文章

  1. JAVA 重载,重写(覆盖)个人理解
  2. Elasticsearch聚合查询案例分享
  3. matlab画出周期为2的方波图形 傅立叶级数_高等数学系列R之四:傅立叶级数及变换...
  4. 不懂Python装饰器?教程双手奉上!
  5. 数据工作者的福音:Google 发布正式版数据搜索工具啦!
  6. 头条+腾讯 NLP 面经
  7. OpenGL基础56:OpenGL简单调试
  8. linux php添加扩展zip libzip ZipArchive功能
  9. [在线小说系统源码]精品微信小程序小说阅读器+后台管理系统|前后分离VUE[包运行成功]
  10. Android一键清空内存,教你一键深度清理手机垃圾,瞬间释放几个G,再也不怕内存不够了...
  11. 沟通CTBS远程接入软件研究
  12. 优秀的项目经理应该具备的能力
  13. 微信小程序中的网络请求
  14. 索尼Z2(L50t)刷CM12教程
  15. EasyExcel初了解
  16. 性能之巅:常用性能分析方法
  17. torchvision.transforms.ColorJitter函数详解
  18. 企业信息化建设,不要轻易选择小众系统
  19. STL(lower_bound)运行时错误
  20. 在Unity中使用FFmpeg将视频绿色背景处理为透明背景

热门文章

  1. [硬货]|如何利用深度学习写诗歌(使用Python进行文本生成)
  2. 研究生周报(第十九周)
  3. 嵌入式行业怎么样,有什么好的就业方向?
  4. jabcob 使用API
  5. Android学习之手机传感器的获取
  6. Chart.js使用教程,画折线图实例
  7. CentOS 6.9安装Python2.7.13
  8. 用微信小程序实现视频通话
  9. [09]微信之itchat库
  10. AutoDL云服务器使用(2)-虚拟环境搭建