Wednesday, March 18, 2009

installing UBUNTU via LAN

OS: UBUNTU 8.04 (Hardy Heron)
Kernel: 2.6.24
Date: March 19th, 2009

Hi everyone, Its been a long from last post, I had been busy :(.
Anyway buckle up this one is going to take a while even to read :)
So today I'll try to explain our (me with one of my buddy) successful effort of installing UBUNTU 8.10 on a laptop without USB booting and apparently its DVD drive was dead. If anyone have same issue or you want it to do it for some other reason (embedded solution, Server- Client type installation system).
Requirements:
1. Obviously working LAN.
2. DHCP server on host.
3. PXE booting capability for client.
4. Bootable ISO of UBUNTU (which you want to install) - called as Alternate CD/DVD.
5. And ya little knowledge of configuring network and about your NIC is nice to have.
6. Host (Server) is considered to be running on Linux (Mine is Ubuntu so packages may be called little different).

So enough of talking, here are the steps:
On your host (Server) you should have following packages installed : (If you don't have them use sudo apt-get install OR synaptic package manager whatever you are comfortable with)

  • tftpd-hpa
  • tftp-hpa
  • dhcp3-server
  • apache2
You may get error message first time you install dhcp server, just because you haven't configured any subnets yet, don't worry we will come to it later.
Now in your web directory (/var/www - default, if you are not sure and you have apache installed) create a directory with the distribution name (well whatever is fine if you don't create a folder thats okay as well however it would look neat and manageable):
  • sudo mkdir /var/www/intrepid (in my case it was /var/www/ubuntu8.04Protik)
  • We will use intrepid for example
If you have DVD/CD then copy the content to this directory:
  • sudo cp /media/path/to/cd/* /var/www/intrepid/ -R
If you have an iso there are 2 ways - Either mount it somewhere and copy the data or mount it directly in /var/www/intrepid. I would suggest copy the content if you want to make it a long term solution, by long term it means at least 10-20 installations otherwise just mounting iso is fine (though will be little bit slower).
We will see command to mount image in the web folder:
  • sudo mount -t iso9660 -o loop /path/to/iso/ubuntu-8.10-alternate-i386.iso /var/www/intrepid
  • P.S. use the ALTERNATE DVD only (it has necessary files for net/lan booting) and substitute ubuntu-8.10 with whichever you have.
  • After this step you can check whether you have it at proper place by opening following page in your browser
http://localhost/intrepid
  • You should see the content of the DVD on this page.

Now configuring tftp :
Edit tftpd-hpa (Use gedit, kate, vi, nano, vim or whatever you like, I'll stick to vi)
  • sudo vi /etc/default/tftpd-hpa
This file should look like :

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS=" -l -s /var/lib/tftpboot"

P.S. RUN_DAEMON line should look exact same and note down the directory its pointing to (in above case /var/lib/tftpboot its default case but you may have different one according to configuration).
Now putting required files for netbooting in this directory:
Copy contents of netboot directory from mounted iso image directory to /var/lib/tftpboot
  • sudo cp -R /var/www/intrepid/install/netboot/* /var/lib/tftpboot
Restart tftps server
  • sudo /etc/init.d/tftp-hpa restart
Check if its been setup properly:
  • tftp localhost -c get pxelinux.0
  • ls -l pxeli*
Make sure the file is bigger than 0 bytes. If not something is wrong go over the above mentioned steps again. Otherwise you are there now proceed (It happened with me that I had pxelinux file as 0 byte as it was a softlink and I had to go through it again :( so make sure you do it carefully and properly).

Now time to setup the DHCP server which will allow client to boot via network
Edit dhcpd.conf according to your settings: (Here I've put general steps as well as part of my dhcpd.conf just to compare both of these may not work for you please check your settings then proceed).
  • sudo vi /etc/dhcp3/dhcpd.conf
Add subnet entry similar to following
      subnet 10.0.0.0 netmask 255.255.0.0 {
host desktop02 {
# only give DHCP information to client computer:
hardware ethernet 00:00:00:00:00:00;
#The MAC address of the network card of the client computer
# Basic DHCP info (see 'ifconfig', 'route', 'cat /etc/resolv.conf')
fixed-address 10.0.0.13;
#the ip address that the regular dhcp server (the router) issues to the client
option subnet-mask 255.255.0.0;
option routers 10.0.0.1;
# the ip address of the router
option domain-name-servers 172.28.1.67, 172.28.1.69;
#the domain name servers your router uses. Don't really know if these are necessary...

# TFPT server for PXE boot
next-server 10.0.0.5;
# ip address of server (this computer)
filename "pxelinux.0";
}
}

And now following is the part of my dhcpd.conf if above one is not clear enough: I preferred wired connection between host and client while server was connected to internet with wireless so the settings given below are for my NIC.

subnet 169.254.9.0 netmask 255.255.255.0{
host desktop02{
hardware ethernet 00:A0:D1:B0:44:87;
#this as the mac address of client fixed-address
fixed-address 169.254.9.13;
# I (hence DHCP while booting process)assigned this ip address client
option subnet-mask 255.255.0.0;
option routers 169.254.9.254;
# I don't think this one even being used :P but I put it. If its useful somehow I can't remeber what should we put there
option domain-name-servers 172.28.1.67, 172.28.1.69;
#These weren't being used for sure as I never connected client to internet
next-server 169.254.9.38;
#this was the ip address of my server (assigned to my NIC) hence subnet is changed to 169.254.9.0
filename "pxelinux.0";
}
}

I'm not that good at network configuration so you may do better job :)
Anyway now start/restart the DHCP server:
  • sudo /etc/init.d/dhcp3-server restart

Now to client side:
  • Put client in pxe booting option (through booting menu most probably F12)
  • Start the installation when UBUNTU ask for country chose:
Enter Information Manually
(The very first entry in country list).
  • When it prompts for hostname put the ip address of server (host)
  • Path to publicly shared folder - folder under www - in our case /intrepid/ (in my case /ubuntu8.04Protik/)
  • Next step (about proxy or something) - leave it blank.
Continue the installation.
And eventually you are done. This kinda installation is little slower than CD/DVD however faster than internet plus if you configure network properly then you can install it on number of machines at a same time :)
Phew I'm completely out of fuel, hope you can read it completely while trying. All the best :)

This solution was posted at : http://ubuntuforums.org/showthread.php?p=6686273#post6686273 (Last checked March 19th, 2009)

No comments:

Post a Comment