Install Ubuntu from a network (LAN) server

For this task, you will need another computer that has Ubuntu installed (and working) and it’s connected to the machine you want to install Ubuntu, through a LAN (Local Area Network). We will call that PC that already has Ubuntu, “Server”, and the PC on which you want to install Ubuntu, “Client”. On the Server, you will install a FTP server, an HTTP server and a DHCP server, which will allow the Client machine to connect to the server and fetch the installation files and package repositories. To install these servers, open a Terminal (Applications -> Accessories -> Terminal) and type:

CODE
sudo apt-get install tftpd-hpa apache2 dhcp3-server openbsd-inetd

Now, mount the Ubuntu 8.04 Alternative ISO image with the following commands:

CODE
cd /path-to-the-iso-image
sudo mkdir /var/lib/tftpboot/ubuntu
sudo mount -o loop ubuntu-8.04-alternate-i386.iso /var/lib/tftpboot/ubuntu (for an i386 PC)

or

sudo mount -o loop ubuntu-8.04-alternate-amd64.iso /var/lib/tftpboot/ubuntu (for an AMD 64/Intel 64 PC)

Make a symlink to the mounted ISO, from the Apache’s root directory:

CODE
cd /var/www
sudo ln -s /var/lib/tftpboot/ubuntu/

If the Server has a CD/DVD-ROM drive and you already have burned the Ubuntu 8.04 Alternate ISO installation CD, insert it in the optical drive and wait for it to get auto-mounted. It will probably get mounted under the /media/cdrom path, so we will need to create symlinks for both FTP and HTTP servers. Copy and paste the following commands in a Terminal window:

CODE
sudo ln -s /media/cdrom /var/lib/tftpboot/ubuntu/
sudo ln -s /media/cdrom /var/www/ubuntu

Now, configure the DHCP daemon. Download the dhcp config file:

CODE
cd /etc/dhcp3
sudo mv dhcpd.conf dhcpd.conf.old
sudo gedit dhcpd.conf

Copy and paste the following lines into the dhcpd.conf file:

CODE
ping-check = 1;
filename = "ubuntu/install/netboot/pxelinux.0";
subnet 192.168.1.0
netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.254;
}

Edit the following directives to match your network:

■ REPLACE the subnet with your network subnet
■ REPLACE the netmask with your network netmask
■ REPLACE the range of IPs with the corresponding IP addresses from your network. An IP address from this range will be randomly assigned to the Client computer.

Restart the DHCP server with the following command:

CODE
sudo /etc/init.d/dhcp3-server restart

At this point, your client machine is ready to boot the alternative installation ISO from the server. Power up the Client PC, enter the BIOS, search for the ‘Boot from network’ options (under the BOOT menu) and put it as the first boot device. Save and exit. If everything worked out well, you should see the Ubuntu installation screen and boot prompt. Install Ubuntu!

About Abhradip Mukherjee

has wrote 86 articles on this blog.

Abhradip Mukherjee is a System Engineer by profession. He has worked on latest technologies like Cloud Computing & Virtualization. He is the founder of Passion4Freedom and can be reached at abhradipm@gmail.com .