I recently bought a laptop with a broken cdrom drive and this is how I’ve managed to put Ubuntu on it. The process is based on this tutorial on the official Ubuntu help site, although it differs slightly in software used and goes into more detail.

The Problem

I have a laptop I want to install Ubuntu on and I can’t use the cdrom. This method is also useful if you want to install Ubuntu on a bunch of machines at the same time without having to deal with the hassle of burning multiple copies of the cd image.

Minimum Requirements

This process is faily complicated and requires a few things that aren’t normally available. First off you need the target computer to support booting over PXE. Most modern BIOS support this nowadays, but if you’re dealing with legacy hardware this could be an issue. The second basic component is another computer which will act as the PXE server. You’ll need to install a dhcp server, a tftp server, and you’ll need to configure it to act as a internet proxy for the target computer. The point is that you need full access to this machine and you’ll need to have both machines connected over a network, preferably ethernet.

My setup

To make the tutorial easier to follow here’s what I have and what it’s called.

Joker (192.168.2.X) is the laptop I want to install Ubuntu on, it is connected through a switch to blackmesa (192.168.2.1) which is another laptop which acts as a router for the house network, it does dhcp, tftp and ip forwarding so that the other computers can get to the internet.

Let’s get started

First we’ll get blackmesa setup to serve the files we need. We’ll need to download the alternate cd image, or one of the minimal install images. The alternate image can be found next to the normal desktop and server images on any of the Ubuntu ftp mirrors. The minimal cd images are linked from a page on the Ubuntu help wiki.

The tutorial uses dnsmasq as the dhcp and tftp server, I used dhcp3-server because that’s what I already had running. dhcp3-server doesn’t have a built-in tftp server so we’ll need one as well.

sudo apt-get install tftpd-hpa tftp-hpa xinetd dhcp3-server

My /etc/dhcp3/dhcpd.conf file looks like this:

subnet 192.168.2.0 netmask 255.255.255.0 {
    option routers 192.168.2.1;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 80.58.61.250, 80.58.61.254;
    range dynamic-bootp 192.168.2.2 192.168.2.254;
    default-lease-time 21600;
    max-lease-time 43200;
    filename "pxelinux.0";
    next-server 192.168.2.1;
}

The important lines are the last two. filename specifies what the file PXE will try to grab is called, pxelinux.0 is the normal value for this and what the file Ubuntu uses is called. next-server tells the client computer where to find the PXE files. In this case, because the tftp server and the dhcp server are the same the ip number is the same.

Now we copy the files we need for netboot. We mount the iso image as a loop device:

sudo mount -t iso9660 -o loop ubuntu-8.04.1-alternate-i386.iso /media/cdrom

And copy the files we need to the tftp server folder

sudo cp -a /media/cdrom/install/netboot/* /var/lib/tftpboot/

Next we configure the tftp server by creating a new file called /etc/xinetd.d/tftp, it should look something like this:

service tftp
{
    disable                 = no
    socket_type             = dgram
    wait                    = yes
    user                    = root
    server                  = /usr/sbin/in.tftpd
    server_args             = -v -s /var/lib/tftpboot
}

And reboot the tftp service

sudo killall -HUP xinetd

The last thing you need to do is enable the host computer to do ip forwarding so that the client computer can get to the internet and download the packages it needs. To do so is fairly simple:

sudo su
echo 1 > /proc/sys/net/ipv4/ip_forward

If all is well we’re done setting up the host machine, blackmesa in this case.

Onto the client

Telling the client to boot from the network device is very easy but varies wildly from BIOS to BIOS. In my case I had to go into the boot order page and enable Ethernet device and set it as first option. Now when you reboot, your computer will bring up a text based installer. If it doesn’t and it gets stuck grabbing dhcp or comunicating with the tftp server then something is going wrong, in my case the process was so quick I didn’t even see this screen.

Once in the text based installer, continue the install process as you normally would, but remember to disable network booting after you’re done or you’ll get sent to the text based installer when you reboot.

 

4 Responses to HOWTO: Install Ubuntu over a network

  1. ClashTheBunny says:

    You have a typo “dchp3-server” -> “dhcp3-server”

  2. hermann says:

    Fixed, thanks!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Set your Twitter account name in your settings to use the TwitterBar Section.