Group: Linux/Unix

通过网络安装ubuntu dapper
刘兆锋 | Apr 9, 2007 3:17:01 PM

Sunday, June 4

Ubuntu dapper PXE network install

I've been testing out the Ubuntu network install environment today. All you need to use the PXE installer is to configure a DHCP server and TFTP server on your network, if you want a more hands off install you can use a "preseed" file. Quite easy to use and it is much more flexible then the ananconda kickstart files.
Ubuntu actually support the kickstart file format as well, so if you don't want to learn the new preconfigure "preseed" format you can just write a normal kickstart syntax file and netboot Ubuntu exactly the same way you would a Redhat/Centos/Fedora box.

Simple instructions on how to configure a Ubuntu netboot server. My install server "tessy" has IP 192.168.95.20 in this example and I'm installing the VIA C3 shoebox PC "elmer" with IP 192.168.95.30.
Don't forget to disable any other DHCP servers you may have on the network such as in broadband routers. Download the netboot.tar.gz and Ubuntu ISO of your choice. I saved both files in the /dl volume on my server.

apt-get install tftpd-hpa
apt-get install dhcp3-server
mkdir -p /var/www/ubuntu-606-server-i386/
mount -o loop /dl/ubuntu-6.06-server-i386.iso /var/www/ubuntu-606-server-i386/
tar xzvf /dl/netboot.tar.gz -C /var/lib/tftpboot

Update the following files to suite your setup:
/etc/default/tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"


/etc/dhcp3/dhcpd.conf
ddns-update-style none;
option domain-name "hifichoice.com";
option domain-name-servers 83.146.21.6, 212.158.248.5;
ping-check = 1;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.95.0 netmask 255.255.255.0 {
range 192.168.95.100 192.168.95.150;
option routers 192.168.95.1;
filename="pxelinux.0";
next-server 192.168.95.20;
}


/var/lib/tftpboot/pxelinux.cfg/default
DISPLAY ubuntu-installer/i386/boot-screens/boot.txt
PROMPT 1
TIMEOUT 0
label install-simple
kernel ubuntu-installer/i386/linux
append initrd=ubuntu-installer/i386/initrd.gz \ -
ramdisk_size=14984 root=/dev/rd/0 rw preseed/locale=en_US \ -
kbd-chooser/method=us netcfg/wireless_wep= netcfg/choose_interface=eth0 \ -
netcfg/get_hostname=elmer preseed/url=http://192.168.95.20/preseed-606-auto.cfg --
LABEL install
kernel ubuntu-installer/i386/linux
append vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=14332 \ -
root=/dev/rd/0 rw --

My /var/www/preseed-606-auto.cfg
You'll get a few prompts, but nothing annoying. I'll have a deeper look into the preseed file format some other day. I'm sure a hands-off install is possible.

The Ubuntu wiki has a netboot article here and you can read more about the preseed file here.

9 comments:

Jorge E. Gomez said...

Hampus,

I tried this, and the installer fails while trying to fetch a "binutils" file which was updated shortly after dapper was finally released (bug 49269)

Did you find this bug? would you care to list the contents of your directory: /var/www/ubuntu-606-server-i386/pool/main/b/binutils/ ?

Anonymous said...

I did this without specifying a preseed file (and another time with a Kubuntu preseed) and had no trouble with either.

Anonymous said...

Thanks for the config examples, they are helpful. One question- how did you boot Elmer? How did Elmer find the installation server? Do you have a special NIC, or a boot disk on Elmer?

thx!

Hampus said...

"Elmer" is a VIA C3 machine with a PXE capable ethernet controller. When the machine boots up I press F12 (I think) to get to the boot device menu, select Network boot and the PXE functionality picks up the boot info via DHCP. There are two extra lines in the DHCPD, one to point to a boot server (which has tftp installed) and the other points to the file to request via tftp.
filename="pxelinux.0";
next-server 192.168.95.20;

Hampus said...

Jorge,
I had no problems with the binutils package. Not sure if that bug exists in the server release. I haven't tried with the desktop cd.

Anonymous said...

It took me ages to get this to work! No fault of yours I hasten to add.

I was trying to boot one laptop from another, the client laptop had no cd floppy or bootable usb.

I had them connected directly to each other via ethernet but the client could not see the network at all.

Eventually I went though my router and it worked fine!

I think the problem was:

a) I'm a complete noob

b) You're meant to go through a router and I didn't know that ('cos I'm a noob).

c) My ethernet cables are "straight through" and need to be "crossover", thats just a wild guess btw.

I also didn't need a preseed file, it worked as soon as I went via my router.

Anyway, thanks for the info

Tony Z

p.s. A little knowledge is a dangerous thing!!

Hampus said...

I'll be posting an updated and more in depth post about 6.10 as soon as the final version is out.
Currently got a 1013 daily build running in test.

Possibly a post about installing from a USB or card-reader device as well.

Anonymous said...

I followed your exact examples, changing only my IP addresses and everything worked fine. I did this network install on Ubunty 6.10 with no problems. Not sure exactly what is going on internally, but it got the job done! THANKS!

PS - your instructions worked better than about 4 or 5 other blogs I saw claiming to do a PXE boot. For some reason, everyone else has different instructions on how to PXE install! It's not consistent.

rodatwork at the gmail place. said...

Well done! I too was having issues with the myriad of instructions regarding PXE booting and Ubuntu Edgy.

I spent a day getting the Kickstart method working-- but I wasn't satisfied as Ubuntu does not have the full kicstart command set -- 'part swap --recommended', returned with a 'getopt --recommended unknown'.

That was it, so I spend half the day trying to get it 'right'. Was just about to give up (for today) and saw your article (well, read it again).

The big issue for me-- people were using preseed for locale in the append string, and that kept the local/language/keyboard showing up-- ug.

Looked at your append-- saw it didn't have a preseed in front... and well, I'm happily installing away.

Thanks again!


















Comment: (17 replies total, Click here for more)


04/17/2007 刘兆锋
beryl是个三维桌面效果
07/05/2007 Tom Zheng
最近我一直在研究redhat的kickstart。可以实现网络的自动安装。整个过程不需要人的介入和干预。

把安装参数都写入一个配置文件。安装的时候自动读取就可以了
07/06/2007 刘兆锋
对,我也感兴趣。但我近一段时间没再弄redhat。

To post your comment, Please login first.