Skip to content

Latest commit

 

History

History
87 lines (53 loc) · 3.36 KB

lab5.md

File metadata and controls

87 lines (53 loc) · 3.36 KB

5. Lab: Booting the Linux operating system over the network

Instructions

  1. Use the network and virtual machines from the previous labs.
  2. Prepare the kernel and initial virtual disk (initrd) in the correct folder.
  3. Update the system bootloader configuration file to boot the kernel and initial virtual disk.
  4. Prepare a Network File System (NFS) server to provide a network drive.
  5. Update the bootloader configuration file to use a network drive to boot the operating system.

Additional information

Instructions for mounting the root file system via NFS (nfsroot).

Detailed instructions

1. Task

The kernel and initial virtual disk are also obtained from the installation image of the selected Linux operating system and transferred to the /srv/tftp folder.

cd /srv/tftp
mkdir casper
cd casper
cp /mnt/casper/vmlinuz .
cp /mnt/casper/initrd.lz .
cd ..

2. Task

Let's check the contents of the bootloader configuration file.

nano pxelinux.cfg/default

label live
  menu label Start Linux Mint
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/linuxmint.seed boot=casper initrd=/casper/initrd.lz quiet splash --

We can see that the paths to the kernel and the initial virtual disk are absolute and we need to change them to relative (without / in front). We also remove the quiet splash -- flags to allow the logs to be printed during booting.

label live
  menu label Start Linux Mint
  kernel casper/vmlinuz
  append  file=/cdrom/preseed/linuxmint.seed boot=casper initrd=casper/initrd.lz

3. Task

Let's install an NFS server that allows us to efficiently access the file over the network. For example, let's install nfs-kernel-server.

apt install nfs-kernel-server

In the configuration file of the NFS server /etc/exports, we set the folder that we will offer over the network, for example /media/cdrom, to everyone who accesses the server and in read-only mode *(ro).

nano /etc/exports 

/media/cdrom *(ro)

For the settings to take effect, restart the nfs-kernel-server NFS server.

systemctl restart nfs-kernel-server.service

Now let's make sure all the installation image files are available in this folder. Next, unmount the /mnt folder, where we currently have the installation image mounted.

umount /mnt

Then mount the installation image in the /media/cdrom folder.

mount /dev/sr0 /media/cdrom

Let's test the operation of the NFS server locally by trying to connect the network drive to the /mnt folder.

mount -t nfs localhost:/media/cdrom /mnt

ls /mnt

umount /mnt

4. Task

Now we have to enable access to the file system of the operating system via the NFS protocol in the configuration file of the bootloader pxelinux.cfg/default. By setting the network boot protocol to NFS netboot=nfs, the root of the file system to the folder provided by the NFS server nfsroot=10.0.0.1:/media/cdrom and adding the automatic acquisition of the IP address when the operating system is booting ip=dhcp.

nano pxelinux.cfg/default

label live
  menu label Start Linux Mint
  kernel casper/vmlinuz
  append  file=/cdrom/preseed/linuxmint.seed netboot=nfs nfsroot=10.0.0.1:/media/cdrom initrd=casper/initrd.lz ip=dhcp