Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: HOWTO: PXE booting Ubuntu Installer

  1. #1
    Join Date
    Dec 2009
    Location
    Chennai, India
    Beans
    88
    Distro
    Ubuntu 10.04 Lucid Lynx

    Lightbulb HOWTO: PXE booting Ubuntu Installer

    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

    1. Set up a PXE Server
      1. Configure network interfaces
      2. Installing Xinet Daemon, DHCP Server and TFTP Server
      3. Configure Inet daemon [xinetd]
      4. Configure TFTP server [tftpd-hpa]
      5. Configure DHCP Server [dhcp3-server]

    2. Fetch the boot files
    3. Preparing the client system
    4. 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
    Code:
    INTERFACES="eth1"
    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.
    Code:
    $ cd /tftpboot
    $ lftp -c "open http://archive.ubuntu.com/ubuntu/dis...ages/netboot/; mirror"
    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
    Code:
    $ man <command>
    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.
    Last edited by yogesh.girikumar; March 1st, 2010 at 12:54 PM. Reason: Removed unnecessary points

  2. #2
    Join Date
    Feb 2010
    Beans
    6

    Re: HOWTO: PXE booting Ubuntu Installer

    SUPERB GUIDE!

    One question:

    Code:
    #option definitions
    option domain-name "slashsupport.com";
    option domain-name-servers 10.10.6.3;
    Do we need the domain name and name servers?
    Could you write a couple of lines to your guide how the domain name and name servers work in this solution and how should we edit them if needed?



    One comment:

    When I try to boot with custom boot menu, it passes pxelinux.0, but fails at pxelinux.cfg file, resulting in "cannot load kernel".

    I had to change it to this =>

    Code:
    default ubuntu-installer/i386/boot-screens/vesamenu.c32
    instead of this

    Code:
    default vesamenu.c32
    Last edited by Zalanthas; February 25th, 2010 at 01:18 AM.

  3. #3
    Join Date
    Dec 2009
    Location
    Chennai, India
    Beans
    88
    Distro
    Ubuntu 10.04 Lucid Lynx

    Exclamation Re: HOWTO: PXE booting Ubuntu Installer

    Hi Zalanthas,

    Quote Originally Posted by Zalanthas View Post
    SUPERB GUIDE!
    Thanks !

    Quote Originally Posted by Zalanthas View Post
    Do we need the domain name and name servers?
    Could you write a couple of lines to your guide how the domain name and name servers work in this solution and how should we edit them if needed?
    Having a domain name is optional. If your organization has a common domain name, then you can just add it in the dhcpd.conf file. This parameter will be supplied to the client when a DHCPOFFER is given out.

    The domain-name-server directive is used to pass the address of the organizational domain name server.

    see: http://www.nisi.ab.ca/lrp/Packages/m...conf.5.man.htm ( EXAMPLES section )

    Quote Originally Posted by Zalanthas View Post

    When I try to boot with custom boot menu, it passes pxelinux.0, but fails at pxelinux.cfg file, resulting in "cannot load kernel".

    I had to change it to this =>

    Code:
    default ubuntu-installer/i386/boot-screens/vesamenu.c32
    instead of this

    Code:
    default vesamenu.c32
    Yes! I am sorry! I should have mentioned. Right after you fetch the files from the server, you can ( for the sake of simplicity ) create a symbolic link for the files in the top directory.

    Code:
    $ sudo ln -s ./ubuntu-installer/i386/boot-screens/vesamenu.c32 ./vesamenu.c32
    I had done this and referred to the symlink

    Thanks for the comments.
    Last edited by yogesh.girikumar; March 1st, 2010 at 11:29 AM. Reason: minor edit

  4. #4
    Join Date
    Jun 2006
    Beans
    36

    Re: HOWTO: PXE booting Ubuntu Installer

    Trying to fiddling with server lucid i386.
    might be a bug in lucid server distro with dhcpd3 package. I get...

    Code:
     * Stopping DHCP server dhcpd3
       ...fail!
     * Starting DHCP server dhcpd3
     * check syslog for diagnostics.
       ...fail!
    I'm not quite clear on this domain name and domain name server thing. What should they be if my router already is running dhcp server? Do I need to turn the router dhcp server off?

  5. #5
    Join Date
    Mar 2006
    Beans
    153

    Re: HOWTO: PXE booting Ubuntu Installer

    Quote Originally Posted by mchlor View Post
    Trying to fiddling with server lucid i386.
    might be a bug in lucid server distro with dhcpd3 package. I get...

    Code:
     * Stopping DHCP server dhcpd3
       ...fail!
     * Starting DHCP server dhcpd3
     * check syslog for diagnostics.
       ...fail!
    I'm not quite clear on this domain name and domain name server thing. What should they be if my router already is running dhcp server? Do I need to turn the router dhcp server off?
    Did you ever find an answer to this error, I get the same error when dhcp tries to start up.

  6. #6
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: HOWTO: PXE booting Ubuntu Installer

    I followed a mixture of these 2 links:
    https://help.ubuntu.com/community/In...n/QuickNetboot (just the first 3 steps) the best solution for ubuntu 10.10 netbooting with tftp is dnsmasq and atftp
    Then I followed this guide http://www.linuxreaders.com/2010/06/...-ubuntu-10-04/
    with a minor change: mount ubuntu-10.04-desktop-i386.iso /mnt/iso should be mount loop -o ubuntu-10.04-desktop-i386.iso /mnt/iso

    and then before executing Enter following in /etc/exports install
    NFS kernel server

    I now have ubuntu maverick up and running on a machine with no cdrom and/or usb
    Last edited by kufio; November 24th, 2010 at 11:36 AM.

  7. #7
    Join Date
    Nov 2006
    Location
    Texas, US
    Beans
    36
    Distro
    Ubuntu

    Re: HOWTO: PXE booting Ubuntu Installer

    I was JUST about to start one of these.
    The problem I personally ran into, was setting up a DHCP server. Building one is fine, yet I wanted to use the one on my router yet did not have options for identifying tftp boot files, or the like. Since I am a hard head and love to tinker I took a day off and started a tftp proxy to the router using the dnsmasq proxy feature for this. Your tutorial is a complete array, and well written. Think you might want to add a snippet for the users that might not want to setup dhcpd, or cant use dhcpd's feature? I have it drafted, and can send it by email.
    If Linux doesn't have the solution, you have the wrong problem
    -- Gerard Beekmans, LFS

  8. #8
    Join Date
    Dec 2009
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: PXE booting Ubuntu Installer

    Ive been trying to get tftpd-hpa to work for a year and still no luck. Times out even on the local machine. Says it is running with
    Code:
    julius@Caesar:~$ ps -e | grep tftp
     4599 ?        00:00:00 in.tftpd
    julius@Caesar:~$
    and
    Code:
    julius@Caesar:~$ netstat -a | grep tftp
    udp        0      0 *:tftp                  *:*                                
    julius@Caesar:~$
    Code:
    tftp> julius@Caesar:~$ tftp localhost
    tftp> get version.info
    Transfer timed out.
    version.info exists in /tftpboot.
    I have been trying to install ubuntu on my laptop this way for a year or more. The cd rom is broken and I am on dialup. I downloaded the 10.04 alternate image to upgrade from karmic on this machine. I run old debian that is way outdated. To update one package on that machine it has to update 100 more. Dialup sux. I miss my roadrunner. BEEP! BEEP!

  9. #9
    Join Date
    Dec 2009
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: PXE booting Ubuntu Installer

    This is etc/xinetd.d/tftp:

    # 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
    }

    This is /etc/default/tftpd-hpa:

    # /etc/default/tftpd-hpa

    RUN_DAEMON="yes"
    OPTIONS="-l -s /tftpboot"

    Every sign says it is running, but it wont respond in any way.
    Any takers?

  10. #10
    Join Date
    Dec 2009
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: PXE booting Ubuntu Installer

    Ahhhh! I got it!
    No one ever mentions the fact that you need a tab whitespace before each statement in between the brackets.

    Then i changed the ownership back to root.
    Now the file looks like this:

    # TFTP configuration
    service tftp
    {
    socket_type = dgram
    protocol = udp
    port = 69
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd
    server_args = -s /tftpboot
    disable = no
    }
    Atleast I have it working locally now. Now to get that laptop in the other room to connect.
    Last edited by tfultz33; December 18th, 2010 at 07:53 AM. Reason: tabs didn't transfer to paste

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •