Over the last few years, I’ve spent most of my working career on Oracle Solaris and some of the technologies like IPS, Automated Installer, SMF, Zones and ZFS. It’s been a pleasure, though not without hiccups at times like all good evolving technologies. I’m very much a fan of a consistent set of technologies that are well integrated with each other and, once you get the basics of their use, are extremely powerful in deploying systems and services reliably and repeatedly. I’ve been on the team developing the SPARC Model 300 and we’ve been fortunate to put many of the Solaris best practices to use in building out that service over the past year.
Today, I put myself back in Linux land for a few hours to set up a Kickstart server so I could automate some bare metal Linux servers for a future Oracle Cloud project. I’m pretty familiar with Linux generally and figured I’d get it running on a Solaris non-global zone – since it’s really just a PXE boot using DHCP, TFTP and a web server like Apache. So I figured I’d write down the process in a blog in case others find it useful:
Installing Apache
We’ll use the Apache webserver to serve out the installation files for Oracle Linux. It’s not installed in a non-global zone, but easy to quickly install it from the package repository.
# pkg install apache-24 # svcadm enable apache24
We’ll also create a directory for Oracle Linux 7.3.
# mkdir /var/apache2/2.4/htdocs/oracle-isos
Downloading Oracle Linux 7.3
You can download the DVD iso from oracle.com easily enough. Once we have the iso, we need to mount the contents and copy into our document root.
# lofiadm -a /var/apache/2/2.4/htdocs/oracle-iso/OracleLinux-R7-U3-Server-x86_64-dvd.iso # mount -o ro -F hsfs /dev/lofi/1 /mnt # mkdir /var/apache2/2.4/htdocs/OL7.3 # rsync -avz /mnt/ /var/apache2/2.4/htdocs/OL7.3/ # umount /mnt # lofiadm -d /dev/lofi/1
Configuring DHCP
PXE boot relies on DHCP so if you have a DHCP server setup, it’s relatively easy to add the appropriate configuration. If you don’t, simply install ISC DHCP from the package repository>
# pkg install isc-dhcp
The default configuration file is located in /etc/inet/dhcpd4.conf. Depending on your network, you can easily replace with your configuration. The important part is pointing to the boot images. Here’s an example file:
allow booting;
allow bootp;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;
option domain-name "us.oracle.com";
subnet 10.134.208.0 netmask 255.255.254.0 {
option routers 10.134.209.1;
if substring(vendorclass, 0, 9)="PXEClient" {
if pxetype=00:06 or pxetype=00:07 {
filename "efi/BOOTX64.efi";
} else {
filename "pxelinux/pxelinux.0";
}
}
pool {
range 10.134.209.210 10.134.209.220;
}
next-server 10.134.209.204;
}
In our case, we’ll be hosting the DHCP server on the same host (10.134.209.204) as our Apache web server – the Solaris NGZ. Once that’s in place, we need to enable the service using SMF.
# svcadm enable dhcp/server:ipv4
Configuring TFTP
The Kickstart process pulls the boot images down using TFTP. So we need to configure the TFTP service. We will use the default location /tftpboot for our boot images. Again, we need to install this package into the NGZ. We’ll create directories for UEFI and BIOS based systems.
# pkg install tftp # mkdir /tftpboot # svcadm enable tftp/udp6:default # mkdir /tftpboot/efi # mkdir -p /tftpboot/pxelinux/pxelinux.cfg
Copying the boot images
Here’s the bit that gets a little messy when compared to Oracle Solaris Automated Installer. We need to copy some of the files over from the document root and set up some of the boot menus.
# cp /var/apache2/2.4/htdocs/OL7.3/EFI/BOOT/BOOTX64.EFI /tftpboot/efi/ # cp /var/apache2/2.4/htdocs/OL7.3/isolinux/initrd.img /tftpboot/efi/ # cp /var/apache2/2.4/htdocs/OL7.3/isolinux/vmlinuz /tftpboot/efi/ # cp /var/apache2/2.4/htdocs/OL7.3/isolinux/splash.png /tftpboot/efi/
First we’ll populate the UEFI boot menu /tftpboot/efi/efidefault:
default=0
hiddenmenu
splashimage=(nd)/splash.png
timeout=0
title Oracle Linux 7 Update 3 Installation
root (nd)
kernel /vmlinuz ks=http://10.134.209.204/ol7u3_cfg.ks
initrd /initrd.img
Essentially we’re pointing it at the boot images and pointing to a Kickstart configuration file located in our document root (ol7u3_cfg.ks). Next, we’ll do the same for BIOS based systems:
# cp /var/apache2/2.4/htdocs/efidefault /tftpboot/efi/ # ln /tftpboot/efi/vmlinuz /tftpboot/pxelinux/vmlinuz # ln /tftpboot/efi/initrd.img /tftpboot/pxelinux/initrd.img
Then populate /tftpboot/pxelinux/pxelinux.cfg/default
prompt 0 default ol7_u3 timeout 0 label linux menu label ^Install Oracle Linux 7.3 kernel vmlinuz append initrd=initrd.img ks=http://10.134.209.204/ol7u3_cfg.ks
There’s obviously a lot of options here in terms of how we want to install systems, and we can create specific configuration files for different sets of hosts according to their MAC addresses. But we’ll keep it simple for now. We also have a few missing files that we still need to get from the ISO – these are easy to get if you’re hosting on Linux, but we’ll have to delve into an RPM package to get them.
# pkg install rpm # cd /tftpboot/pxelinux # rpm2cpio /var/apache2/2.4/htdocs/OL7.3/Packages/syslinux-4.05-13.el7.x86_64.rpm | cpio -icvd "*/usr/share/syslinux/pxelinux.0" # mv usr/share/syslinux/pxelinux.0 /tftpboot/pxelinux/
Creating the Kickstart file
Now finally we can author our Kickstart file that essentially describes what software we will install, some basic system configuration such as language, keyboard layout, timezone, user accounts, etc. The important bit is that we point it at our unpacked Apache document root in which to get the RPM packages.
install url --url="http://10.134.209.204/OL7.3/" lang en_US.UTF-8 keyboard us network --onboot yes --device link --bootproto dhcp --noipv6 --hostname testhost rootpw manager firewall --service=ssh authconfig --enableshadow --passalgo=sha512 selinux --disabled timezone --utc America/Los_Angeles bootloader --location=mbr --boot-drive=sda text skipx zerombr clearpart --all --initlabel autopart firstboot --disabled poweroff %packages @core %end
Once we’ve done that, we can simply netboot our system, connect to our DHCP server for an address, get the location for the boot images and download them using TFTP and off we go! So yes, easy to host a Kickstart server on Solaris. Not quite as nice an experience when compared to Automated Installer and installadm(1M). Hope it proves useful to someone!