Hi,
I looked around for a tutorial on this but couldn't find one. So I wrote this myself. This setup worked for me. Hope it works for you too. Let me know if you face any issues.
UBUNTU PXE BOOT INSTALLATION
Ubuntu is usually installed on a system using a Live CD. Another method of installing it is over the network! PXE stands for Preboot eXecution Environment which is an environment for booting the Ubuntu installer off the network. This is helpful in installing Ubuntu on systems which do not have a CD-ROM drive. This can also be used to automate the installation process using preseeding on a large number of systems.
STEPS INVOLVED
- Set up a PXE Server
- Configure network interfaces
- Installing Xinet Daemon, DHCP Server and TFTP Server
- Configure Inet daemon [xinetd]
- Configure TFTP server [tftpd-hpa]
- Configure DHCP Server [dhcp3-server]
- Fetch the boot files
- Preparing the client system
- Boot the client system
Setting up a PXE Server
A PXE Server is a system that serves the client ( on which the system has to be installed ) with an IP address and the bootloader file to boot off from. The client system does not need a CD-ROM drive for this type of installation. A NIC card is all that is necessary and it must be able to boot off the network.
How it works:
- The client machine starts and tries to boot off the network.
- It sends a DHCP REQUEST over broadcast.
- A DHCP server in the network gives a DHCP OFFER and provides the client with a valid IP address.
- The DHCP also provides the client with 1. A file name to look for and 2. The TFTP server address (next-server directive) to look into for the file.
- The file is a "pxelinux Loader" ( named pxelinux.0 ). The file is uploaded to the client machine via TFTP.
- The bootloader is then started off the pxelinux Loader file.
- Packages necessary for the installation are fetched off the network ( Internet or a local mirror server )
- Installation is done.
Installing Xinet Daemon, DHCP Server and TFTP Server
Xinetd, DHCP and TFTP are essential in performing a PXE boot. So they have to be installed in the system. To do so, type the following command in the terminal:
Code:
$ sudo apt-get install xinetd tftpd-hpa dhcp3-server
Configure inet daemon
Inet daemon is a super-server daemon. A super-server daemon can start a collection of other related servers. Xinetd is one such super server which stands for eXtended InterNET Daemon. It is capable of starting other networking servers such as FTPD, SSHD, etc..
We installed "xinetd" package. We need to enable inetd at boot time. To do so, execute the following command in the terminal.
Code:
$ sudo update-inetd --enable BOOT
Then restart the inetd server:
Code:
$ sudo /etc/init.d/xinetd restart
Configure TFTP Server
TFTP server is needed to serve the bootloader files necessary to start the installation. TFTP server is available in the package "tftpd-hpa". We have installed tftpd-hpa. Now we have to configure it.
- Create a directory /tftpboot in which we will store all the necessary boot files. Then change the permissions so that it is accessible to the world [ all ].
Code:
$ sudo mkdir /tftpboot
$ sudo chmod -R 774 /tftpboot
Then we need to change the ownership of the directory:
-
Code:
$ sudo chown nobody /tftpboot
We also need to set the permission to 777 in case the above permission doesn't work.
Edit the /etc/default/tftpd-hpa file
Code:
$ sudo nano /etc/default/tftpd-hpa
- Modify the file so that it looks something like this:
Code:
RUN_DAEMON="yes"
OPTIONS="-l -s /tftpboot"
The important changes here are setting RUN_DAEMON to "yes" and changing the directory path to "/tftpboot" We now need to create a tftpd file inside Xinetd. To do so, create a file named tftp in the /etc/xinetd.d/ directory
Code:
$ sudo touch /etc/xinetd.d/tftp
$ sudo nano /etc/xinetd.d/tftp
Then add the following lines to the file
Code:
# TFTP configuration
service tftp
{
socket_type = dgram
protocol = udp
port = 69
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
}
- Now restart xinetd and tftpd-hpa
Code:
$ sudo /etc/init.d/tftpd-hpa restart
$ sudo /etc/init.d/xinetd restart
Configure DHCP Server
DHCP server provides the client machine with a valid IP address so that it can identify itself to the network and fetch files that are necessary for the installation.
The DHCP server should serve over a separate network interface that holds a static address. This can be done by editing the /etc/default/dhcp3-server file
Code:
$ sudo nano /etc/default/dhcp3-server
edit the file so it looks like
if eth1 is the interface where you want DHCP to serve and provide IP addresses. Now we need to configure DHCP Server.
- Create a backup copy of the DHCP config file [ just in case ]
Code:
$ sudo cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.orig.conf
- edit the /etc/dhcp3/dhcpd.conf file
Code:
$ sudo nano /etc/dhcp3/dhcpd.conf
Add the following lines to the configuration file or uncomment them if they are already present
Code:
#option definitions
option domain-name "companydomain.com";
option domain-name-servers 10.10.6.3;
default-lease-time 600;
max-lease-time 7200;
authoritative;
#subnet declaration
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.2 192.168.2.255;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
filename "pxelinux.0";
next-server 192.168.2.100
}
the filename "pxelinux.0"; and "next-server 192.168.2.100"; directives should be added to the file.
Edit: companydomain.com is the domain name of my organization and 10.10.6.3 is the IP address of the local DNS server
Now restart the dhcp server
Code:
$ sudo /etc/init.d/dhcp3-server restart
Fetching the boot files
The boot files and network booting installation scripts and configurations should be downloaded to the TFTP server directory (/tftpboot). The files can be downloaded to the directory using the lftp command. You may have to install lftp program to use it.
Now we need to edit the /tftpboot/pxelinux.cfg/default file. The contents of the file should be something similar to this:
Code:
include ubuntu-installer/i386/boot-screens/menu.cfg
Menu Background sample.png
prompt 0
timeout 0
If you decide to have your own Custom Boot Menu, you can edit the file so that it looks like this. Please comment out or remove the include option.. I have commented it out here in my configuration file ( first line ).
Code:
# include ubuntu-installer/i386/boot-screens/menu.cfg
default vesamenu.c32
Menu Background sample.png
Menu Title Boot Menu
label install
menu label ^Install
menu default
kernel ubuntu-installer/i386/linux
append vga=normal initrd=ubuntu-installer/i386/initrd.gz --quiet
label expert
menu label ^Expert Install
kernel ubuntu-installer/i386/linux
append priority=low vga=normal initrd=ubuntu-installer/i386/initrd.gz --
label cli-expert
menu label Command-^line expert Install
kernel ubuntu-installer/i386/linux
append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false priority=low vga=normal initrd=ubuntu-installer/i386/initrd.gz --
label rescue
menu label ^Rescue Mode
kernel ubuntu-installer/i386/linux
append vga=normal initrd=ubuntu-installer/i386/initrd.gz rescue/enable=true --quiet
label Local_drive
localboot 0
menu label ^Local Drive
prompt 0
timeout 0
Preparing the Client System
The client system needs to be able to boot from the network for this setup to work. The client systems should boot via network first. In order to do this, you may have to change the boot order in the Client machine's BIOS settings. A typical setup would be to boot from Network first and then from Hard Disk.
Booting the client
Switch on the client machine. Check if the BIOS settings are OK and verify if the system is set to boot off the Network first. If All settings are working fine, then the client machine should give out a DHCPREQ DHCP request and get a valid working IP address for itself. Then the BootLoader menu should be shown from where you can proceed with installing the OS.
Should you need help with any command, you can type the following in the terminal
UN-COMMENTING IN CONFIG FILES
Uncommenting lines in the config files can be done by removing a '#' sign from the start of the line. This is usually true for most files. Some file might have a semicolon ';' as a commenting symbol instead of '#'. To comment out a line, simply add a '#' or a ';' (whichever is appropriate) to the start of the line.
Bookmarks