灌溉梦想,记录脚步
« »
2010年7月9日技术合集

PXE Network Booting on Ubuntu Linux

1,安装dhcp:

1
$sudo apt-get install dhcp3-server

2,添加pxe配置到dhcpd.conf
next-server 172.28.1.103;
filename “pxelinux.0”;

3,安装tftp服务

1
 $ sudo apt-get install tftpd-hpa tftp-hpa

4,配置tftp

1
2
3
4
 $ sudo nano /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /home/pxetero/"


5,添加tftp用户

1
$ sudo adduser pxetero

允许正常用户访问 /home/pxetero/目录,并允许这个组 tkarvine.

1
2
3
4
 $ whoami 
 tkarvine
 $ sudo chown pxetero.tkarvine /home/pxetero/
 $ sudo chmod g+rwx /home/pxetero

6,下载所需要的文件

1
2
3
4
 $ cd /home/pxetero
 $ wget -np -r http://archive.ubuntu.com/ubuntu/dists/breezy/main/installer-i386/current/images/netboot/
 $ mv archive.ubuntu.com/ubuntu/dists/breezy/main/installer-i386/current/images/netboot/* .
 $ rm -rf archive.ubuntu.com/

7,启动tftp、dhcp并测试

1
2
3
4
5
 $ sudo /etc/init.d/tftpd-hpa start
 $ cd
 $ tftp localhost -c get pxelinux.0
 $ ls pxeli*
 pxelinux.0

这样tftp就是工作正常了,然后启动dhcp

1
$ sudo /etc/init.d/dhcp3-server start

修改 kickstart文件:

1
 $ nano /home/pxetero/pxelinux.cfg/default

在 “label linux”, 和“append” 行之间添加下面配置
ks=http://www.example.com/ks.cfg
修改timeout值
timeout 100
这样客户端就可以使用pxe安装系统了

8,完整 dhcpd.conf 配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# dhcpd.conf for Helia labs
# Copyright 2006 Tero Karvinen http://www.iki.fi/karvinen
# License: GNU General Public License, version 2 or later
# ChangeLog:
# 2006-03-27    Initial version, testing in Helia labs
 
# Don't set "authoritative" until everything else is correct in dhcpd.conf
authoritative;  # Warning: this overrides other DHCP servers
# Default options in Ubuntu:
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
# Subnet row defines server's network card. Also set in "/etc/default/dhcp3-server"
# 'ifconfig' shows subnet (ipaddress, zeroes as in mask)
subnet 172.28.0.0 netmask 255.255.0.0 {
        host terotestaa {
                # 'ping target_host', 'arp' shows MAC address
                # only give DHCP information to this computer:
                hardware ethernet 00:0D:F0:1C:22:33;
                # Basic DHCP info (see 'ifconfig', 'route', 'cat /etc/resolv.conf')
                fixed-address 172.28.1.7;
                option subnet-mask 255.255.0.0;
                option routers 172.28.1.254;
                option domain-name-servers 172.28.1.67, 172.28.1.69;
                # Non-essential DHCP options
                option domain-name "tielab.helia.fi";
                # TFPT server for PXE boot
                server-name "172.28.1.103";
                filename "pxelinux.0";
        }
}
 
# 'sudo /etc/init.d/dhcp3-server force-reload'
# http://www.iki.fi/karvinen

9,完整 pxelinux.cfg/default 配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
display ubuntu-installer/i386/boot-screens/syslinux.txt
default linux
 
F1 ubuntu-installer/i386/boot-screens/f1.txt
F2 ubuntu-installer/i386/boot-screens/f2.txt
F3 ubuntu-installer/i386/boot-screens/f3.txt
F4 ubuntu-installer/i386/boot-screens/f4.txt
F5 ubuntu-installer/i386/boot-screens/f5.txt
F6 ubuntu-installer/i386/boot-screens/f6.txt
F7 ubuntu-installer/i386/boot-screens/f7.txt
F8 ubuntu-installer/i386/boot-screens/f8.txt
F9 ubuntu-installer/i386/boot-screens/f9.txt
F0 ubuntu-installer/i386/boot-screens/f10.txt
 
label linux
        kernel ubuntu-installer/i386/linux
        append vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  -- ks=http://iki.fi/karvinen/notexists-ks.cfg
label expert
        kernel ubuntu-installer/i386/linux
        append DEBCONF_PRIORITY=low vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  --
label server
        kernel ubuntu-installer/i386/linux
        append base-config/package-selection= base-config/install-language-support=false vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  --
label server-expert
        kernel ubuntu-installer/i386/linux
        append base-config/package-selection= base-config/install-language-support=false DEBCONF_PRIORITY=low vga=normal initrd=ubuntu-installer/i386/initrd.gz
ramdisk_size=16432 root=/dev/rd/0 rw  --
 
prompt 1
timeout 20

日志信息 »

该日志于2010-07-09 11:55由 kevin 发表在技术合集分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

发表回复