[经验分享]使用Mac OS做pxe server安装linux

423 views
Skip to first unread message

easthero

unread,
Jun 14, 2011, 2:06:19 AM6/14/11
to sh...@googlegroups.com

使用Mac OS做pxe server安装linux

要装一台RHEL,但是服务器的光驱是cdrom,又只有dvd光盘。而我的MBP上只安装了Mac OS,没有装Linux,于是想用MBP做PXE服务器,利用网络来安装Linux。
需要的软件和在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执行


在 pxelinux.cfg 目录下新建一个default的文件
文件内容如下

DISPLAY boot.txt
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
接下来需要从rhel的光盘中拷贝pxeboot所需要的文件,在光盘的images/pxeboot目录下,把vmlinuz和initrd.img拷到 /private/tftpboot/rhel/5.4/i386目录

再启动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

lyxmoo

unread,
Jun 14, 2011, 2:40:57 AM6/14/11
to Shanghai Linux User Group
介个木有MacOS撒事吧。装个dhcpd 和 tftpd 都能跑的。

On 6月14日, 下午2时06分, easthero <easth...@gmail.com> wrote:
> 使用Mac OS做pxe server安装linux<http://geektang.blogspot.com/2011/06/mac-ospxe-serverlinux.html>

hengi_Q

unread,
Jun 14, 2011, 2:51:41 AM6/14/11
to sh...@googlegroups.com
人家说了只有mac

lyxmoo

unread,
Jun 14, 2011, 3:06:34 AM6/14/11
to Shanghai Linux User Group
tftpd 和 dhcpd 在 macos 上 和 linux 上 或者 *BSD 上有撒区别捏?

easthero

unread,
Jun 14, 2011, 3:08:25 AM6/14/11
to sh...@googlegroups.com
配置基本差不多

区别就是tftp不需要安装,以及服务的启动关闭方式不一样

2011/6/14 lyxmoo <lyx...@gmail.com>
Reply all
Reply to author
Forward
0 new messages