How can i serve an Ubuntu installation Image on my Server for networkboot?

I Would like to Install Ubuntu on my Netbook, that has no CD-Rom.

can I serve the Live-CD on my other computer, so I can install it via the Bios Network-Boot on my Netbook?


Solution 1:

with this help: How do I boot Ubuntu from the network?
and this howto, that is linked there. This tutorial also helped

I collected it all together:

Installation and configuration of a PXE-Server

This is what you have to do on Ubuntu 12.10:

apt-get install inetutils-inetd tftpd-hpa dnsmasq

edit /etc/default/tftpd-hpa so it looks like this:

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -s -v -v"

Mount the Lubuntu 12.10 Desktop ISO and copy it to the tftpboot folder:

mkdir /mnt/loop
mount -o loop -t iso9660 /media/Daten/installer/Linux/lubuntu-12.10-desktop-i386.iso /mnt/loop
mkdir /var/lib/tftpboot/ubuntu-installer
cp -R /mnt/loop/* /var/lib/tftpboot/ubuntu-installer
umount /mnt/loop

edit /etc/dnsmasq.conf and set there:

interface=eth0

dhcp-range=10.0.0.220,10.0.0.250,12h

dhcp-boot=/pxelinux.0,0.0.0.0

now get the pxelinux.0 file by installing SYSLINUX:

apt-get -y install syslinux

Copy the PXELINUX bootstrap to the root of our TFTP server.

cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot

create the file /var/lib/tftpboot/pxelinux.cfg/default (source):

mkdir /var/lib/tftpboot/pxelinux.cfg/

echo "
LABEL u
KERNEL ubuntu-installer/casper/vmlinuz
APPEND tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=normal initrd=ubuntu-installer/casper/initrd.lz -- quiet 
PROMPT 1
DISPLAY banner.txt
" >> /var/lib/tftpboot/pxelinux.cfg/default
# (adjust KERNEL and initrd to the correct path on your machine!)

Then create the banner.txt file:

echo "press 'u' to boot ubuntu" >>/var/lib/tftpboot/banner.txt

configure your eth0 card:

service network-manager stop 

ifconfig eth0 10.0.0.100 netmask 255.255.255.0 broadcast 10.0.0.255

restart the services:

/etc/init.d/dnsmasq restart
killall in.tftpd
service tftpd-hpa restart

now everything should work fine, just connect another computer to your machine on eth0 and select the boot option 'u' there


Errorhandling

If you get the error

"could not find kernel image: ubuntu-installer/i386/linux"

first check if you adjusted the KERNEL and initrd to the correct path on your machine! If thats correct, those will give you some more hints:

ps aux | grep tftp
ss -apu | grep tftp

probably, you have to kill in.tftpd and inetutils-inetd and restart all services while looking at the log:

tail -f /var/log/syslog &
/etc/init.d/dnsmasq restart
killall in.tftpd
/etc/init.d/inetutils-inetd stop
service tftpd-hpa restart
ps aux | grep tftp
ss -apu | grep tftp

probably there you find the message

cannot bind to local IPv4 socket: Address already in use if that message is gone, it should all work fine

Restart normal networking

When you are done, you can restart the NetworkManager by

service network-manager restart

If you use WiFi deactivate the eth0 card by

 ifconfig eth0 down

Now there is only one more open question:
Bad Archive Mirror using PXE networkboot