How To Install Ubuntu Locally Over The Network

By | 2007/10/08

I spent some time this week figuring out the requirements for installing Ubuntu locally over the network. Ubuntu has netboot installers which are more than happy to go find a public repository mirror for you, but how about installing over the LAN using the contents of the CD as the repository? Well, if you’re interested in fast installations and no longer burning CDs this tutorial is for you. You should note that this tutorial is considered intermediate to advanced so please read through the entire contents before you continue and research any steps you’re not familiar with before diving in.

Requirements

This tutorial does not outline PXE boot based installation information. That is for an upcoming tutorial. This simply outlines installing the contents of the CD over the network. In order to do this we’ll need a few basic things:

  1. CD image
  2. Apache
  3. netboot installer

The way that each of these requirements will be used is that we’ll copy the contents of the CD to a web-accessible share on Apache and then boot the machine-to-be-installed via the netboot installer (CD or USB based options available here).

  1. Download the .iso image for the ubuntu version and variant that you want, saving it to disk (alternate, not desktop!).
  2. Install apache “sudo aptitude install apache2” *
  3. netboot installer image i386 64bit (compatible for use with any alternate install image in step #1)

* The configuration of apache is beyond the scope of this tutorial but a basic installation should provide enough core functionality to allow us to continue with the installation.

Preparing the CD for installation

We’ll need to unpack the contents of the downloaded CD .iso file. The way I generally do this is using these commands:

sudo mkdir /var/www/ubuntu/ sudo mount -o loop /path/to/.iso /mnt sudo cp -a /mnt/* /var/www/ubuntu/

If you’re not familiar with the above commands we’re first creating a directory called ubuntu within our apache web-accessible directory. We’re then locally “loop” mounting the CD image to the location /mnt. Finally we’re copying the contents of the CD to our new directory.

Preparing the Installer

We’ll now need a netboot installer created. This is a very minimal installation CD that can be used to install any other Ubuntu image. For example one copy of this netboot installer will allow you to install previous, current and (most likely) future releases of Ubuntu as long as you have access to the web-accessible CD image or public repository. So, although above I promised no more burning CDs you will actually need to burn just *one* more. Also, this netboot installer image is available for CD or USB image if you prefer one over the other (I prefer USB). Hopefully you’ve already followed step #3 of the Requirements section and you have either the mini.iso or the boot.img.gz file downloaded. To prepare either of those for use do follow these steps: mini.iso (CD)

  • (gnome) insert a writable disk into your machine, right-click mini.iso and select “Write to disk”.
  • (KDE) insert a writable disk into your machine, right-click mini.iso and select “Actions > Write CD image with K3B”

boot.img.gz (USB) You’ll first need to uncompress this file before you can write the image to disk:

gunzip boot.img.gz

insert a USB device that you’ll use as your boot device. ALL DATA WILL BE WIPED TO MAKE IT BOOTABLE. You can use the ‘dmesg’ command to see what device your USB was detected as (sdb, sdc, etc). We’ll then write the contents of the image to the device using dd:

dd if=boot.img of=/dev/sdX (where X is the device detected with dmesg, sdb, etc)

Starting The Installer

You should now be ready to install your machine by booting either the CD or via the USB you’ve created. If you have trouble booting to either of those devices you might check your BIOS settings to see that one of them takes priority over the main hard drive. If you are using the boot.img on a USB you will want to remove this device when you are prompted with the language selection menu. This will help avoid conflicts with drives-to-be-installed, where to install the Boot Loader, etc. You’ll be presented with a very basic menu when the netboot installer loads.

To install only the base system type 'server', then ENTER. For the default installation, press ENTER.

The default installation is suitable for most desktop or laptop systems. Navigate through the installer as normal but watch for the step entitled:

Choose a mirror of the Ubuntu archive

At this step we will tell the installer to use a custom repository, in this case being the locally shared CD contents we set up previously. Instead of selecting your country in this step go up to the first option listed: (pg-up to the top)

enter information manually

I don’t think the option of entering custom information is very intuitive so I missed this the first few times through. Watch for this step. If you are given a prompt offering us.archive.ubuntu.com or CC.archive.ubuntu.com you’ve gone too far! The next step will prompt you for the hostname or IP address of the server you will be installing from. This is the IP address of the server you copied the CD contents and installed Apache to. After the hostname or IP is entered the installer will prompt you for the path to the publicly shared contents. If you closely followed these steps the default entry of /ubuntu/ should work. If you copied your CD contents into a folder other than /ubuntu/ you’ll need to update this accordingly. At this point navigate through the installer as normal and enjoy what should be faster installation speeds as network-based is usually faster than CD-based. As usual if you have any questions feel free to leave a comment. It should be noted, again, that this tutorial is probably considered intermediate to advanced so you may not want to undertake this if you’re a n00b.

27 thoughts on “How To Install Ubuntu Locally Over The Network

  1. Pingback: it’s about time» Blog Archive » links for 2007-10-09

  2. Pingback: CTI97 » Blog Archive » Linux news and how-to plus other tech tools  - Catalyst for Creativity & Technology :: Internet, Mobility, Programming, EXpression of digital self !

  3. Pingback: HackITLinux

  4. Pingback: Automated Ubuntu Installation Preview : Ubuntu Tutorials : Dapper - Edgy - Feisty - Gutsy

  5. Jacques

    I just went through your instructions on the weekend. Almost everything worked as you described. Couple of points:

    1. On my installation of Ubuntu (7.04), the system complained that “sudo mkdir /var/www/html/ubuntu/” did not work because the html directory does not exist. Instead, I had to use “sudo mkdir /var/www/apache2-default/ubuntu”

    2. After installation, I found a way to simplify you recipe. You can skip the entire copy step (sudo cp -a /mnt/* /var/www/html/ubuntu/); instead simply link the directory. Here’s the command sequence:

    “sudo mkdir /mnt/ubuntu”
    “sudo mount -o loop ‘/path/to/iso /mnt/ubuntu”
    “sudo ln -s /mnt/ubuntu/ /var/www/apache2-default/ubuntu”

    Hope this helps!

    Reply
  6. joe

    hello, i foolow you step, in section chossing mirror, after i put my ip server which contain ubunu installer, then folder, after that ask proxy, then after that, i got error :
    Bad archive mirror
    The sepcified Ubuntu archieve mirror is neither not available, or does not have a valid release file on it.Please try a different mirror

    i don’t know what’s wrong

    Reply
  7. Ubuntu Tutorials

    @joe – It sounds like its either you’re booting from a mini.iso / boot.img that does not match the version you’ve put on the web server or your web server isn’t accessible. Make sure you can access the files via http://localhost/ubuntu on the webserver to troubleshoot..

    Reply
  8. Pingback: Installing Gutsy Over The LAN | Info Zone : Blog Archive

  9. Arvy

    Installer is reading Release.gpg, server responds but the installer says “the installer failed when downloading from a mirror” (options to retry, chance mirror or cancel). I dont understand since Apache is sending the contents:

    192.168.0.5 – - [21/Dec/2007:00:34:21 -0300] “GET /ubuntu/dists/gutsy/Release HTTP/1.1″ 200 1757
    192.168.0.5 – - [21/Dec/2007:00:34:21 -0300] “GET /ubuntu/dists/gutsy/Release.gpg HTTP/1.1″ 200 189

    Reply
  10. JJ

    Great tutorial BUT I only got as far as Arvy did. Apache is sending the contents but the installer:

    192.168.1.155 – - [05/May/2008:15:35:59 +0200] “GET /ubuntu//dists/hardy/Release HTTP/1.1″ 200 1757 “-” “Wget”
    192.168.1.155 – - [05/May/2008:15:35:59 +0200] “GET /ubuntu//dists/hardy/Release.gpg HTTP/1.1″ 200 189 “-” “Wget”

    But then the installer complains that “Downloading a file failed”. I using the new ubuntu-8.04-desktop-i386.iso and the http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/mini.iso

    Any ideas would be much appreciated.

    Regards,
    JJ

    Reply
  11. rhys

    same as JJ, my web server sends down the release file but then the installer stops saying “Downloading a file failed”. Any responses?

    Reply
  12. JohnMc

    Tried your tutorial for Hardy. I get all the way past the http proxy request. Then I get this message –

    “No kernel modules were found. …”

    I am using an alternate cd and mini.iso installer.

    Any suggestions??

    Reply
  13. joseph

    Ok, I will admit that I am a lil lazy and did do exactly as asked, I like shortcuts… My 2nd server has an issue w/ CDz…

    1. On Server1 I installed apache, downloaded the iso…
    2. Instead of mounting, I just used the Archive Manager to extract the contents to a folder, which I renamed “ubuntu”…
    3. @ prompt, used “mv” to move “ubuntu” into /var/www…

    -now my issue began here as extracting the files to my desktop changes their permissions to just mine… I kept getting and error regarding “no valid release file”… After poking around, I used nautilus (@ prompt: gksudo nautilus) and saw the that others had NO ACCESS to the folder “ubuntu” no even read access…

    4. After changing the permissions for everyone else to “access files”, I was finally able to continue…

    Right now, I am 1/2 thru installation so I will assume it is 100% working… I have to run and get to the dishes… :-P

    Reply
  14. mrhosseini

    hello
    I used your instruction and i got some problems:
    1.I got the following error:
    ” no kernel modules were found….”
    but i continue the installation and i got the following:
    2. “no disk drive was detected…..”

    Reply
  15. Coudy

    Hi,
    I can boot from network, select my local mirror, some files are installed from local server, but after software selection installation is downloading files from internet, why ?

    thank you.

    Reply
  16. gabriel

    hello,
    thanks for this helpfull tutorial. I have follow all steps but error like “no kernel modules were found…” show me another ways.

    1. u don’t need apache Server and cd !!
    2. just take the version of mini.iso u need
    3. follow this tutorial until the point where u have to give the host-name.
    type us.archive.ubuntu.com or XX.archive.ubuntu.com where XX are the land initial .
    note u don’t have to type “http://” !!
    4. the path is /ubuntu/
    it’s ALL

    Reply
  17. JJ

    Great tutorial …. worked like a charm – Thanks.

    One thing to note is that if your router is connected to the internet, it may try and find the latest distribution via the internet as opposed to getting it from your web server.

    This should be added to the Ubuntu community documents

    Reply
  18. JJ

    Anyone have any idea why only the Alternate CD works and not the Desktop?

    Or is there a way to make the Desktop CD (ISO) to work?

    Reply
    1. Christer Edwards Post author

      @JJ – The alternate CD contains accessible .deb packages that are used during installion. The Desktop CD on the other hand, based on its live-CD nature, does not include the .deb packages but is actually a squashfs image that is directly unpacked onto the installation drive. This kind of utility–network installation–allows the admin to customize exactly what is installed on the machine, which requires access to a list of .deb packages. This sort of customization is not possible with a standard squashfs image (which is essentially the same for every machine) as used on the Desktop CD.

      Reply
    1. Christer Edwards Post author

      Linux Mint should work the same way considering Linux Mint is 90% Ubuntu underneath, with a few extras and themes put on top. I would be _very_ surprised if Linux Mint did not work.

      Reply
  19. Bruce Wagner

    I want to install Ubuntu on 100 remotely dispersed machines.

    How can I create an install CD or USB which uses a Kickstart configuration and downloads the Ubuntu image from a public mirror? Can I make it retrieve the Kickstart configuration file from my server via the web?

    Reply
  20. Steven P

    Unfortunately, I wanted to install by network as the optical drive is fried. Thanks anyway…

    Reply
  21. Thomas Lange (Mrfai)

    Have a look at the FAI (Fully Automatic Installation) project. It does a very flexible network installation, using preseeding and a class system. A detailed description about FAI and a list of FAI users can be found at the project page.

    http://fai-project.org

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *