需要的软件和在Linux下一样,就是tftpd+dhcpd。Mac OS Server版自带tftpd和dhcpd,而桌面版只有tftpd,需要自己装dhcpd。Server版的方法见 http://www.shawnhogan.com/2011/05/pxe-network-boot-linux-with-mac-os-x-server.html
1.先装dhcpd。我选择使用Macports
- sudo port install dhcpd #安装dhcpd
- cd /otp/local/etc/dhcp
- sudo cp dhcpd.conf.sample dhcpd.conf
修改 dhcpd.conf 确保有以下内容
subnet 192.168.1.0 netmask 255.255.255.0 {这里根据实际情况修改
range 192.168.1.70 192.168.1.100;
filename "pxelinux.0";
next-server 192.168.1.50;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
然后启动dhcpd
sudo launchctl load -w /Library/LaunchDaemons/org.macports.dhcpd.plist
2.配置 tftp
先 sudo -H -s切为root用户,以下命令以root执行
- cd /private/tftpboot
- wget http://ftp.uk.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0 #下载一个pxelinux.0
- mkdir pxelinux.cfg
- mkdir -p rhel/5.4/i386
在 pxelinux.cfg 目录下新建一个default的文件
文件内容如下
DISPLAY boot.txt接下来需要从rhel的光盘中拷贝pxeboot所需要的文件,在光盘的images/pxeboot目录下,把vmlinuz和initrd.img拷到 /private/tftpboot/rhel/5.4/i386目录
DEFAULT rhel5.4_i386_install
LABEL rhel5.4_i386_install
kernel rhel/5.4/i386/vmlinuz
append vga=normal initrd=rhel/5.4/i386/initrd.img --
PROMPT 1
TIMEOUT 0
再启动tftp
sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist
基本就可以了,装完以后想关掉tftp和dhcp,执行以下命令就可以了
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.dhcpd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/tftp.plist
可参考我以前的这篇 http://geektang.blogspot.com/2009/07/debian-pxe.html

没有评论:
发表评论