|
Other versions:
|
Contents |
Following Ubuntu's DisklessUbuntuHowto first you need to setup the pre-requisites.
Throughout this article the following IP addresses are going to be used, adjust appropriately for your network.
IP address Description 10.30.2.1 Router and DNS server or proxy 10.30.2.2 DHCP and TFTP server 10.30.2.10 NFS server 10.30.2.20 LTSP server 10.30.2.100-200 LTSP clients
You will also need to find the MAC address of your Ubuntu machine, this can usually find this by viewing the BIOS startup messages when you first switch on your machine, or via the ifconfig command in Linux.
$ ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:10.30.2.20 Bcast:10.30.2.255 Mask:255.255.255.0
inet6 addr: fe80::230:1bff:feb7:a209/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7431458 errors:0 dropped:0 overruns:0 frame:0
TX packets:8036876 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3120402141 (2.9 GiB) TX bytes:3281854310 (3.0 GiB)
Interrupt:169
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:186875 errors:0 dropped:0 overruns:0 frame:0
TX packets:186875 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5422502 (5.1 MiB) TX bytes:5422502 (5.1 MiB)
We will also assume that the NAS device is exporting a directory we are going to use as NFS root for the Ubuntu machine called /mnt/nfsroot.
Without a local HDD the Ubuntu server needs network services to assign it an IP address, provide it a kernel, and provide a root network file system. The IP address is provided by DHCP, the kernel by TFTP, and the root file system by NFS.
We need to prepare a small directory structure to copy to the TFTP server, all the files provided by TFTP usually reside in a directory /tftpboot, we will first create one in /tmp.
$ mkdir -p /tmp/tftpboot/pxelinux.cfg $ mkdir /tmp/tftpboot/ubuntu-edgy
To copy the PXE boot image we first need to install the syslinux package.
$ sudo apt-get install syslinux $ sudo cp /usr/lib/syslinux/pxelinux.0 /tmp/tftpboot
Lets find which Linux kernel version we have and copy it in.
$ ls -ltr /boot/vmlinuz-* -rw-r--r-- 1 root root 1636226 2006-10-06 08:53 /boot/vmlinuz-2.6.17-10-generic $ cp /boot/vmlinuz-* /tmp/tftpboot/ubuntu-edgy
The Linux kernel no longer provides support for a root filing system, it has to be implemented in user space. This is a relatively standard procedure and uses an "initial root disk" or initrd image. We have to create a new image that supports network booting. First we duplicate the initramfs configuration.
$ sudo cp -Rp /etc/initramfs-tools /etc/initramfs-tools-pxe
Modify /etc/initramfs-tools-pxe/initramfs.conf to change BOOT=local to BOOT=nfs
# # BOOT: [ local | nfs ] # # local - Boot off of local media (harddrive, USB stick). # # nfs - Boot using an NFS drive as the root of the drive. # BOOT=nfs
Create a new initramfs image, replace the version numbers as appropriate.
$ sudo mkinitramfs -d /etc/initramfs-tools-pxe -o /tmp/tftpboot/ubuntu-edgy/initrd.img-2.6.17-10-generic 2.6.17-10-generic
Finally create a PXE configuration file, (Ctrl+D) terminates cat.
$ cat > /tmp/tftpboot/pxelinux.cfg/default
LABEL ubuntu-edgy
kernel ubuntu-edgy/vmlinuz-2.6.17.10-generic
append root=/dev/nfs nfsroot=10.30.2.10:/mnt/nfsroot/ubuntu-edgy ip=dhcp initrd=ubuntu-edgy/initrd.img-2.6.17-10-generic rw --
PROMPT 1
TIMEOUT 0
The next step depends if you have a ocean server setup or another Linux machine with dhcpd and tftpd.
Configure the LAN IP address to be 10.30.2.2 using the console setup. Access the web administration interface using a web browser. For DHCP you need to configure several items.
Enable the TFTP server.
Now using the web interface upload all the files in the tftpboot directory.
Now proceed to the next section: Migrate to NFS
Create a dhcp configuration file /etc/dhcp3/dhcpd.conf.
# dhcpd.conf
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "example.com";
option domain-name-servers 10.30.2.1;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# ltsp server network
subnet 10.30.2.0 netmask 255.255.255.0 {
range 10.30.2.100 10.30.2.200;
option routers 10.30.2.1;
filename "pxelinux.0";
next-server 10.30.2.2;
# ubuntu server
host ubuntu {
hardware ethernet xx:xx:xx:xx:xx:xx; ➊
fixed-address 10.30.2.20;
option host-name "ubuntu";
}
}
➊ Replace with the ethernet address of your Ubuntu host.
Update the atftpd configuration in /etc/default/atftpd
USE_INETD=false OPTIONS="--daemon --port 69 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /tftpboot"
Copy the /tmp/tftpboot directory to your DHCP/TFTP server and start both daemons.
Ubuntu comes with a NFS client but it does not have locking functionality unless an extra package is installed. Without this package the NFS mount process can take a very long time unless locking is explicitly disabled.
$ sudo apt-get install nfs-client
We use the mount command and specify the NFS server, exported share, and local directory we want the share to appear. This directory must already exist, /mnt is a covenient choice.
$ sudo mount 10.30.2.10:/mnt/nfsroot /mnt
For a FreeNAS file server you should now create a new sub-directory for ubuntu, this will save the root directory for other versions, backups, or other shared documents.
$ sudo mkdir /mnt/ubuntu-edgy
A simply copy, we specify "-x" to only copy one file system, we do not want to copy NFS into itself.
$ sudo cp -ax /. /mnt/ubuntu-edgy/. $ sudo cp -ax /dev/. /mnt/ubuntu-edgy/dev/.
The /etc/fstab file contains static information about all the mounted file systems, it is read at boot time after the kernel as finished loading. As there no longer is a HDD we need to specify NFS as the root file system.
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/nfs / nfs defaults 0 0 # removable media /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
The fifth and sixth parameters are set to zero (0), dump is not installed by default in Ubuntu; the NFS device integrity is handled by the server not the client, so the sixth parameter informs fsck to ignore it.
With Ubuntu Edgy /var/run and /var/lock are automatically tmpfs file systems, it is possible to mount /tmp and/or /var/tmp in tmpfs too like Solaris but this is not recommended by the Linux developers, and /var/tmp on tmpfs violates the LSB.
none /tmp tmpfs defaults 0 0 none /var/tmp tmpfs defaults 0 0
As NFS is used for the root file system the network interface (NIC) has already been configured and running. This means we no longer need to configure that interface as part of the usual boot process. In fact we have to change the configuration or else we will loose the root file system. Remove the default interface from /etc/network/interfaces.
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface, commented out for NFS root #auto eth0 #iface eth0 inet dhcp
Reboot and confirm everything is working.
© 2009 Novell, Inc. All Rights Reserved.