13

I would like to install Ubuntu for almost 120 users. But it's very difficult in using USB and drives.

Any suggestions?

4 Answers 4

11

You can install one Ubuntu system (typically an Ubuntu Server system, but it does not have to be), and then use it as a server to PXE boot and install the others. The BIOSes on the clients (where you want to install Ubuntu) must support PXE (i.e., network boot) for this to work. But most BIOSes do, these days.

You should be able to do it with a non-Ubuntu system as the host, too, if you already have that set up and you know how to configure the necessary servers on your non-Ubuntu system.


The PXEInstallServer Ubuntu help wiki article explains how to set up an Ubuntu system as your PXE server, and how to install Ubuntu on other systems from it. It would be hard to summarize the main points--the details are very important. So here's the whole thing (with minor formatting and punctuation changes):

Introduction

This will guide you through running an Ubuntu server as PXE install server. You'll need to run a DHCP server on your network, not necessarily this server but you do need one.

Installing needed packages

You'll need to install the following packages: inetutils-inetd (previously netkit-inetd), tftpd-hpa (see InstallingSoftware).

  • For Ubuntu 10.04, there is a bug with inetutils-inetd. It only listens on IPv6, and not on IPv4. As a quick workaround, you can use openbsd-inetd instead.

If this is also going to be your DHCP server, install dhcp server contained in the follwing package: dhcp3-server (see InstallingSoftware).

Configure tftpd-hpa

You'll need to tell tftpd-hpa to start its daemon (which it doesn't by default). To do this, edit the /etc/default/tftpd-hpa file, and make sure that it looks something like this:

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

Then, run the startup script to actually start the daemon:

/etc/init.d/tftpd-hpa restart

Configure dhcpd

If your pxe server is also your dhcp server, you'll need something like this in /etc/dhcp3/dhcpd.conf:

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.100 192.168.0.200;
        filename "pxelinux.0";
}

If you have an existing dhcp server, you should point it to your pxe server by doing something like the following:

subnet 192.168.0.0 netmask 255.255.255.0 {
    <other config here>
    filename "pxelinux.0";
    next-server <pxe host>;
}

Be sure to restart your dhcp server so that the changes take effect:

sudo /etc/init.d/dhcp3-server restart

Configure tftpd-hpa

tftpd-hpa is called from inetd. The options passed to tftpd-hpa when it starts are thus found in /etc/inetd.conf

The defaults are fine for us, your /etc/inetd.conf should have an entry like this:

tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

(Although you may need to edit this file and replace udp with udp4, as tftpd-hpa seems to expect an IPv6 address now.)

Now we'll copy the needed files from the Ubuntu CD:

sudo cp -r /media/cdrom/install/netboot/* /var/lib/tftpboot/

If your dhcp server issues correct network info and your pxe clients will have network access, then at this point you will be able to do an Ubuntu install using internet repositories.

I want to go a little further however and install everything from the install server as well as customise some of the packages to install.

Install apache

Currently nfs installs aren't well supported (please correct me if I'm wrong) so we'll install over http. For that we need a webserver on our install server too: install the following package: apache (see InstallingSoftware).

Copying Ubuntu files

Create an ubuntu directory under your freshly installed apache's document root and copy all of the contents of the Ubuntu Alternate CD to that directory:

mkdir /var/www/ubuntu
cp -r /media/cdrom/* /var/www/ubuntu/

Customising the install

There is a package called system-config-kickstart which is a GUI frontend to creating kickstart files. The kickstart file tells the installer where to get its packages from, what to install and a number of other useful settings. See KickstartCompatibility for more info.

This package does not have to be installed on your install server, it can be on a convenient Ubuntu desktop somewhere.

Create a custom ks.cfg with system-config-kickstart, be sure to specify HTTP under "Installation Method". Provide the IP of you install server and make the HTTP Directory /ubuntu/. Save the file and copy it to your install server under /var/www/html/.

A very minimalist `ks.cfg file which only uses the installation files on the install server and asks for all other questions might look like this:

install
url --url http://192.168.0.1/ubuntu/

Use your ks.cfg

In order for your network Ubuntu install to use your kickstart file, you have to tell it where to find it. Edit /var/lib/tftpboot/pxelinux.cfg/default and add ks=http://<installserver>/ks.cfg to the append line. It should then look something like this (note that the append line is one line):

label linux
        kernel ubuntu-installer/i386/linux
        append ks=http://192.168.0.1/ks.cfg vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432

root=/dev/rd/0 rw --

In Jaunty [and presumably later releases, including any release you're likely using]1 the default file has been broken up into includes. The append line can be found in /ubuntu-installer/i386/boot-screens/text.cfg:

label install
        menu label ^Install (from my http server)
        menu default
        kernel ubuntu-installer/i386/linux
        append ks=http://192.168.0.1/ks.cfg vga=normal initrd=ubuntu-installer/i386/initrd.gz -- quiet

Boot and install

You should now be able to boot another pc on the lan over the network and have it install Ubuntu automagically. :) You can vary the tftp and http install points to have multiple versions of Ubuntu available to install on your network.

Using the CD (or .iso) directly

You can also achieve the above without actually copying any files anywhere. You can mount the CD (or the .iso) and then do additional mounts with the --bind option. The advantage is that you can upgrade the CD (or the .iso) without needing to update the install server files.

For example, after mounting the CD (or the .iso) to /media/cdrom/, you can mount the ubuntu files to the web directory:

mount --bind /media/cdrom/ /var/www/ubuntu/

Similarly, you can do the same with the tftproot:

mount --bind /media/cdrom/install/netboot/ /var/lib/tftpboot/

If you were to create a pxelinux.cfg directory with an appropriate default file, you can mount that over the top of the mounted CD, so that the tftp server gives out your pxelinux.cfg/default file. For example, a pxelinux.cfg directory in ~/pxelinux.cfg could be mounted like this:

mount --bind ~/pxelinux.cfg /var/lib/tftpboot/pxelinux.cfg

(Note that in the above example, the actual mount point of the directory would end up as /var/lib/tftpboot/ubuntu-installer/i386/pxelinux.cfg because the pxelinux.cfg is a symlink on the CD (or .iso)).

PXEInstallServer, with slight formatting, punctuation, and capitalization changes, mainly to accomodate the Ask Ubuntu Format.

That article is from the Ubuntu documentation wiki. It was written by "Contributors to the Ubuntu documentation wiki" and is licensed under CC-BY-SA 3.0, which allows inclusion here, with proper attribution.

1[Bracketed italicized text] is not from the original; it is my commentary.


Note the difference between this method and the method Mitch suggested. That method involves booting from a CD/DVD or USB flash drive, which then installs the system over a network. By default this network is the Internet; for that method to be reasonable for installing to hundreds of machines on a network, you would probably want to create and host an Ubuntu repository on your network, and point your installations to that.

The effort and infrastructure necessary to do that is comparable to what would be necessary to PXE boot the machines as described above. So while that way might meet your needs, I'd encourage you to consider PXE booting if you really need to install without "physical media."

1
  • Would I need to change any settings in my router? Jan 6, 2016 at 22:23
4

You can do that by using the net install method starting an installation of Ubuntu over the network. described at Netboot Install

Network installer

The network installer lets you install Ubuntu over the network. This is useful, for example, if you have an old machine with a non-bootable CD-ROM or a computer that can’t run the graphical interface-based installer, either because they don’t meet the minimum requirements for the live CD/DVD or because they require extra configuration before the graphical desktop can be used, or if you want to install Ubuntu on a large number of computers at once.Ubuntu

Download the network installer for 12.04 LTS

Download the network installer for 13.04

3

There are so many way to accomplish this.

1 - Netboot

You must modify the host names and IP addresses in this HOWTO for your own setup. The principles described here are applicable to other DHCP and TFTP servers than those described below; using alternate server software is left as an exercise for the reader.

For instructions on how to use a windows computer as the TFTP and DHCP server, head to Installation/WindowsServerNetboot.

This HOWTO will get you as far as running the installer; if you want to perform automated or unattended installs of Ubuntu, see Installation/LocalNet.

2 - LocalNet

This installation method utilizes DHCP/BOOTP, TFTP, and FTP/HTTP to obtain the installation sources. The installer itself is made up of a Linux kernel and an initrd. These files are transferred via the DHCP/TFTP boot process.

The remainder of the installation sources can be transferred via FTP or HTTP. If the target machine has internet access these sources could be pulled directly from an Ubuntu mirror. Alternatively, you could download one of the installation ISO's, loop-back mount them, and serve them with a local HTTP/FTP server.

3 - NetworkConsole

Booting from a CD (could be TFTP or similar too) and installing the system over SSH.

4 - Quick Install over SSH

A quick guide for installing Hardy Ubuntu 12.04 on a dedicated server over ssh.

Take a look the full documentation of Server and network installations

2

What worked for me when installing Ubuntu 18.04 LTS was based on a guide by Isabel Castello, which seems based on the LocalNet guide from the Ubuntu wiki, but was much more readable and understandable to me.

Prerequisites

You must be on a network with 3 nodes:

  1. A basic DHCP router.
  2. The target server, where you want to install Ubuntu. It must be connected to the router with a cable (not WiFi). And obviously have support for network booting in BIOS.
  3. A source server, which will serve initial installation files & services. This guide assumes it's also Ubuntu; other OSes are surely possible too, but commands would obviously be different.

Steps

  1. Make sure to enable Network Boot in target's BIOS.

    Entering BIOS is often done by pressing or holding Del or F2 when the machine boots. Alternatively, pressing F12 often allows altering the boot sequence in some vendor-specific way, which may help.

  2. Find out the following values:

    (You may want to browse/change the DHCP settings on the router to find out some of those. Also, if you manage to enter the Network Boot stage when booting the target machine, it will probably show at least the MAC address, so you can note it down.)

    • the target's MAC address — property of its network card,
    • the target's IP address — assigned to it by the router,
    • the gateway IP — in other words, IP of the router,
    • the subnet/network mask — usually found in source's and/or router's network settings.
  3. Install and configure tftp on the source host:

    $ sudo apt-get install tftpd-hpa
    $ grep TFTP_DIRECTORY /etc/default/tftpd-hpa 
    TFTP_DIRECTORY="/var/lib/tftpboot"
    $ wget http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/netboot.tar.gz
    $ sudo tar xzvf netboot.tar.gz -C /var/lib/tftpboot/
    $ rm netboot.tar.gz
    

    If the grep above shows a different path, adjust the values in commands listed in this and next step accordingly.

  4. Install, configure, and run bootp, also on the source host:

    Note: replace $TARGET_MAC etc. values with appropriate values collected in step 2. above. The $TARGET_MAC address should be with colons, e.g.: 00:00:39:2B:54:B5, and $SUBNET_MASK dotted, e.g. 255.255.255.0.

    $ sudo apt-get install bootp
    $ vim ./bootptab
    client: ha="$TARGET_MAC": ip=$TARGET_IP: gw=$GATEWAY_IP: sm=$SUBNET_MASK: td=/: hd=/: bf=pxelinux.0
    $ sudo bootpd -d 4 -c /var/lib/tftpboot -s $PWD/bootptab
    
  5. Reboot the target machine, while ensuring the Network Boot feature is enabled (press F12 if needed, or nothing, or whatever else your BIOS requires).

    A text-based interactive Ubuntu 18.04 installer should start now on the target machine. Continue as if installing Ubuntu normally.

  6. Extra: for safety, after finishing the install, you should make sure to toggle the Network Boot feature in target's BIOS back to disabled.

Hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .