Software Developer

Install Ubuntu From a Local Network Using Network Boot

This is how to install Ubuntu on a computer which does not have a working CD drive, and which will not boot from USB. This shows you how to install Ubuntu from one computer to another computer. In technical terms, this is called “booting the installer from a local network server, using DHCP, TFTP, and PXE”. This is useful when you have a really old laptop or desktop which you want to revive.

These instructions are straight from Ubuntu, but the steps here are made a bit clearer for non-programmers.

What You Need

  • The computer which you want to install Ubuntu on. This will be called “the client“. This computer must have the ability to boot from a network.
  • a separate working computer running Ubuntu or other Linux distro (this will be called your “server“). When these steps ask you to type something in terminal, you can open a terminal window on this computer by pressing “Ctrl”, “Alt”, “T” together.
  • a local network (LAN). (If you have a home Wifi network, then you probably already have this set up.)
  • One Ethernet cable (or whatever type of data cable your router accepts) for temporary use. This will only be used during setup and installation.
  1. Set up your router

    1. Make sure your router is working and using DHCP. Most home Wifi networks provide this. If you have internet service from a cable company, then you probably already have a router with a DHCP server.
    2. Make sure that your “server” computer has access to the router. If you are on the Wifi network, then you have access to the router.
    3. Write down the gateway address of the router. To get the gateway address of your router, type the command route in terminal. The address will be listed in the “Gateway” column under the heading “Gateway”. This is a series of numbers and dots.
    4. Write down the subnet mask for your LAN. To get this, type ifconfig in terminal. The subnet mask is labeled “Mask:“. This is a series of numbers and dots.
      • This will give you several blocks of information. You will see “Mask:” more than once. To choose the correct Mask, use the one who has a “Bcast” (Broadcast) address before it. And it should also have a “HWaddr” address on the line preceding the Mask. The Mask for that block is the correct subnet mask. Write this down.

  2. Gather data from the client

    In this step, both pieces of information that you need to write down will be found on the same screen. To see this screen, first make sure that the client machine is set to boot first from its network adapter. You may have to enter the BIOS setup screen on startup to enable network booting and/or to change the boot order. If you enter the BIOS screen, whether or not you make changes, shut down the machine before proceeding.

    1. Connect the client machine directly to the router with an Ethernet cable (or whatever type of data cable your router accepts). Connect one end of the cable to your client machine. Connect the other end to one of the ports on your router. This is known as a “hardline” connection, or “wired” connection (as opposed to a wireless connection). This hardline connection is only needed during installation. Later, after the installation is complete, you should be able to use WiFi.
    2. Start the client machine. On some machines, you have to press something like “F12” during start-up to boot from the network. Now, as it attempts to boot from the network, you will see both of these pieces of information on the screen:
    3. Write down the client’s MAC address. The MAC address is listed as six groups of two hexadecimal digits, separated by hyphens (-)
    4. Write down the client’s IP address.

      If the IP address is not on the page, then do this:

      • Leave the client machine turned on and hard-lined to the router. Now, on your server machine, open a web browser. Type your gateway address into the address bar (you wrote this down in Step 1c). It will ask you for a user name and password. For user name, use “admin“. For password, use “password“. Click on “Attached Devices”. Find your client machine in the “Device Name” column. Its IP address will be listed in the column next to it. Write the IP adress down. If you’re not sure which is your client machine on the list of devices, write down all of the IP adresses, then shut down the client machine, wait a few seconds, and refresh your page on the server machine. You will notice that 1 of the devices disappeared. The device that disappeared will be your client machine (which you just shut down).
  3. Set up a bootp server on your server machine

    1. Install bootp on your server machine. To do this, type this in terminal:

      sudo apt-get install bootp
    2. Edit the file, /etc/bootptab, with your own details. To do this, type this in terminal:

      sudo gedit /etc/bootptab

      Instead of “sudo gedit”, you can type whichever text editor you use. For example, “sudo leafpad …”.

      Paste this into the file:

      client:
      ha="00:00:39:2B:54:B5":
      ip=192.168.1.42:
      gw=192.168.1.1:
      sm=255.255.255.0:
      td=/: hd=/: bf=pxelinux.0
      

      Make these edits to what you paste (you gathered all of this data in the previous steps):

      ha = Replace the number within quotes with the client’s MAC address. Leave the quotes surrounding the number in place.
      ip = Replace the number with the client’s IP address.
      gw = Replace the number with your router’s gateway address (yours is probably is the same).
      sm = Replace the number with the subnet mask for your LAN.

      Leave all the colons and slashes in place. Save and close the file.

    3. Next, create a file called bootp in the init.d directory. To do this, type this in terminal:

      sudo gedit /etc/init.d/bootp

      In the bootp file, paste this wrapper code to start and stop bootpd:

      vDaemon=bootpd
      vCd=/var/lib/tftpboot
      
      Start () {
          echo -n "Starting $vDaemon: default current directory is at $vCd ... :"
          /usr/sbin/$vDaemon -d 4 -c $vCd >/tmp/$vDaemon.log 2>/tmp/$vDaemon.err &
          sleep 1
          Status
      }
      
      Stop () {
              echo "Stopping $vDaemon ..."
          kill `pidof $vDaemon`
      }
      
      Reload () {
          if [ "`pidof $vDaemon`" ] ; then
              echo "Reloading config file for $vDaemon ..."
              kill -HUP "`pidof $vDaemon`"
          fi
          Status
      }
      
      Status () {
          vPid="`pidof $vDaemon`"
          if [ "$vPid" ] ; then
              echo "$vDaemon running, pid=$vPid"
          else
              echo "$vDaemon not running"
          fi
      }
      
      case "$1" in
          start)      Start ;;
          stop)       Stop ;;
          reload) Reload ;;
          restart) Stop ; sleep 2; Start ;;
          status) Status ;;
          ""|*) echo `basename $0` parameter: start stop status reload or restart ;;
      esac
      

      Save and close the file.

    4. Give the bootp file proper permissions by typing this in terminal:

      sudo chmod 755 /etc/init.d/bootp
    5. Restart bootp by typing this in terminal:

      sudo /etc/init.d/bootp restart
  4. Set up the tftp server

    1. Install tftpd-hpa by typing this in terminal:

      sudo apt-get install tftpd-hpa
    2. Open the tftp configuration file by typing this in terminal:

      sudo gedit /etc/default/tftpd-hpa

      In the file, make sure that the TFTP_DIRECTORY is set to equal “/var/lib/tftpboot”.

      Save and close the file.

    3. Download one of these Ubuntu 14.04 LTS (Trusty Tahr) netboot installer tarfiles from the Ubuntu Archives:

      For 64-bit Intel/AMD (x86_64)

      For 32-bit Intel/AMD (x86)

      (For other architectures, see this.)

      The download may take a while. Make sure you let it complete. This is your chance to take a break.

    4. Move the downloaded file into the tftp server root by typing this into terminal:

      sudo mv Downloads/netboot.tar.gz /var/lib/tftpboot/netboot.tar.gz

      You may have to change “Downloads” to match the path of your downloaded file.

    5. Move to the tftp server root, then extract the contents of the file:

      cd /var/lib/tftpboot/
      sudo tar -zxvf netboot.tar.gz
    6. Remove the zipped tarball, which we don’t need anymore since we extracted its contents. Type this:

      sudo rm netboot.tar.gz
  5. Install Ubuntu on the client machine

    1. Make sure your client machine is still connected to the router with the Ethernet cable (or whatever type of data cable your router accepts).
    2. Make sure your client machine is set up to boot from the network (see step 2). Shut the machine down.
    3. Start the machine. It will attempt to boot from the network. The Ubuntu installation process should begin.
    4. If the Ubuntu installation process begins on your client machine, then this tutorial has worked for you. You were able to serve the installation over the network to a computer which could not boot from a CD nor USB. Congratulations. Follow the Ubuntu installation process, which, unfortunately, could take a very long time. See Ubuntu Installation help (x86) if you need it (or for AMD64 & Intel EM64T).

In your comments below, please give the step number and letter that you’re having a problem with.

By

We've 5 Responses

  1. September 6th, 2014 at 12:31 pm

    When I enter “ifconfig wlan” into the terminal, I get the following message:
    “wlan: error fetching interface information: Device not found”

    However, I do see a Genmask value when I enter “route” into the terminal. Can I use this value?

    avatar
    • September 8th, 2014 at 12:43 pm

      Sorry for the delay. I just updated the steps to fix that. Type just “ifconfig” in terminal (without wlan). See the new Step 1d above for details on how to pick out the correct mask. Hope this helps.

      avatar
      • September 8th, 2014 at 12:55 pm

        Thanks! I figured out another way to find the client ip address and mac address. The rest of the tutorial works like a charm and this has been a huge help!

        avatar
  2. July 9th, 2017 at 6:10 pm

    So, I have an old Toshiba netbook (NB255-N250), and it just wouldn’t work, giving an error of “no boot filename received.” I’m new to Ubuntu, and running 14.04 ubuntu studio on my laptop which I love, and really want to replace windows 7 on my netbook. I found and tried installing Ubuntu 12.10 via Wubi. That worked. Unfortunately, it installs Firefox 16 (1.0 for Ubuntu) and it’s not fun, and apparently no upgrade path. Tried to install Chromium, but chickened out when it defaulted to 64-bit. Tried updating via the ubuntu software center but apparently the upgrade paths have closed.

    According to Windows 7 the processor is 32 bit, yet the intel page at http://ark.intel.com/products/49491/Intel-Atom-Processor-N455-512K-Cache-1_66-GHz says the Atom N455 (the netbook’s processor) handles the 64-bit instruction set (so maybe I could’ve installed the chromium…)

    Anyway, being a newbie I’m reluctant to stay on an unsupported release, and the browser, frankly, stinks, so back I came and tried the 64-bit version, just in case, but alas, same old “no boot filename received.” Did a search on that, and found you’ve got to but stopped b/c I realized your article says nothing about that. Figured it was time to ask a question. Are pxe modifications (not mentioned above) required? Any idea if I have any options from here? Thanks.

    avatar
    • July 9th, 2017 at 6:15 pm

      Whoops. In the above there’s missing text. Please insert After:
      “you’ve got to”
      and before:
      “but stopped”
      this:
      “configure your PXE server, which involves setting up /tftpboot with the pxelinux.0 file,”
      don’t know where that typed information disappeared to…

      avatar

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]