Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Oracle Linux Cookbook

You're reading from   Oracle Linux Cookbook Embrace Oracle Linux and master Linux Server Management

Arrow left icon
Product type Paperback
Published in Jan 2024
Publisher Packt
ISBN-13 9781803249285
Length 548 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Erik Benner Erik Benner
Author Profile Icon Erik Benner
Erik Benner
Mr. Jonathan Spindel Mr. Jonathan Spindel
Author Profile Icon Mr. Jonathan Spindel
Mr. Jonathan Spindel
Erik B. Thomsen Erik B. Thomsen
Author Profile Icon Erik B. Thomsen
Erik B. Thomsen
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Chapter 1: Oracle Linux 8 – Get It? Got It? Good! 2. Chapter 2: Installing with and without Automation Magic FREE CHAPTER 3. Chapter 3: Exploring the Various Boot Options and Kernels in Oracle Linux 4. Chapter 4: Creating and Managing Single-Instance Filesystems 5. Chapter 5: Software Management with DNF 6. Chapter 6: Eliminating All the SPOFs! An Exercise in Redundancy 7. Chapter 7: Oracle Linux 8 – Patching Doesn’t Have to Mean Rebooting 8. Chapter 8: DevOps Automation Tools – Terraform, Ansible, Packer, and More 9. Chapter 9: Keeping the Data Safe – Securing a System 10. Chapter 10: Revisiting Modules and AppStreams 11. Chapter 11: Lions, Tigers, and Containers – Oh My! Podman and Friends 12. Chapter 12: Navigating Ansible Waters 13. Chapter 13: Let’s All Go to the Cloud 14. Index 15. Other Books You May Enjoy

Serving up the boot – TFTPD

TFTP is used for simple file transfers over the network. This is most often used to load the initial bootloader for an OS, or some firmware updates for embedded devices and older hardware. In the context of the PXE server, the TFTP system is used for the initial bootloader.

Getting ready

To set up a TFTP server, you will need an Oracle Linux 8 VM running in your environment. The server should be on the same network subnet that the systems being built are using. Ideally, you should also have enough space for several boot files. Normally, 5 GB is enough data space.

How to do it…

Installing TFTP is simple. Run the dnf install -y tftp-server command, as seen in Figure 2.12.

Figure 2.12 – TFTP installation

Figure 2.12 – TFTP installation

Once the installation is complete, we need to open up the firewall for TFTP and reload it:

firewall-cmd --add-service=tftp --permanent
firewall-cmd --reload

The output of these commands is as shown in the following screenshot:

Figure 2.13 – TFTP firewall

Figure 2.13 – TFTP firewall

After installation and the firewall has opened, we need to prepare the system by installing the bootloaders, preparing an Oracle Linux 8 TFTP location, and creating a boot menu.

Note

This example is using a BIOS-based host. If you want to use a UEFI host, you will need to install grub2-efi and configure UEFI-specific parameters. The Oracle docs for this can be found at https://docs.oracle.com/en/operating-systems/oracle-linux/8/install/install-CreatingaNetworkInstallationSetup.html#uefi-clients.

To install the bootloaders for BIOS-based installs, we will install the syslinux package. The syslinux package includes bootloaders for network booting (PXELINUX), Linux (ext2/ext3/ext4) or btrfs filesystems (EXTLINUX), MS-DOS FAT filesystems (SYSLINUX), and bootable El Torito CD-ROMs (ISOLINUX). For network booting, we will be using PXELINUX:

Figure 2.14 – Syslinux installation

Figure 2.14 – Syslinux installation

Next, we will copy the boot image file, pxelinux.0, and copy the file into /var/lib/tftpboot:

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

Then, we will create an Oracle Linux 8 boot directory under tftpboot:

mkdir /var/lib/tftpboot/ol8

Now, we need to copy over the PXE boot files from the ISO we previously mounted when installing the HTTP server to the new Oracle Linux 8 boot directory:

cp /var/www/html/OL8/images/pxeboot/* /var/lib/tftpboot/ol8/

Next, we need a boot menu. Luckily, we can copy over the samples and get things moving quickly. We only need the menu files, so using the following command to copy things works just fine:

cp -v /usr/share/syslinux/{ldlinux.c32,libcom32.c32,libutil.c32,menu.c32,vesamenu.c32} /var/lib/tftpboot/

Almost done here. To make a directory for the PXS config files and build the default menu, use the following:

mkdir /var/lib/tftpboot/pxelinux.cfg

We can finally install a config file. Copy this sample configuration file into /var/lib/tftpboot/pxelinux.cfg/default:

default linux-auto
prompt 1
timeout 60
display boot.msg
label linux-auto
  menu label ^Install OL8 in Graphical Mode using the kickstart file
  menu default
  kernel ol8/vmlinuz
  append initrd=ol8/initrd.img ip=dhcp inst.repo=http://pxe.lab.m57.local/ol8 ks=http://pxe.lab.m57.local/ks_files/ol8ks.cfg
label linux-manual
  menu label ^Install OL8 in Graphical Mode with manual input
  menu default
  kernel ol8/vmlinuz
  append initrd=ol8/initrd.img ip=dhcp inst.repo=http://pxe.lab.m57.local/ol8
label rescue
  menu label ^Rescue installed system
  kernel ol8/vmlinuz
  append initrd=ol8/initrd.img rescue
label local
  menu label Boot from ^local drive
  localboot 0xffff

In this sample, the default install will be linux-auto, and that will start in 60 seconds unless the user manually selects one of the following options:

  • linux-auto: This is the default and will install Oracle Linux using the kickstart parameters
  • linux-manual: This will kick off a traditional install or Oracle Linux, prompting the user to select all the options from Anaconda manually
  • rescue: This will boot in rescue mode
  • local: This will boot from the existing local disk

You can easily modify the menus as needed to meet your specific needs. PXE booting, while daunting at first, provides a powerful tool to manage your Linux installations.

How it works…

When systems boot, they will load the bootloader based on the DHCP server config. This will then have the system boot from the TFTP server, starting the PXE process.

You have been reading a chapter from
Oracle Linux Cookbook
Published in: Jan 2024
Publisher: Packt
ISBN-13: 9781803249285
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image