New network and scripted install features in Photon OS TP2

VMware just hit the next milestone of Project Photon: Photon OS Technology Preview 2 (TP2).  There are numerous enhancements, especially around deployment and management.  One welcome feature is support for guest OS customization in vSphere – now it is possible to deploy by cloning a VM template or from the new Content Library. DHCP as well as static IP addressing are supported, along with the expected guest naming capabilities.

In addition to that, Photon OS TP2 supports network booting via PXE, which can be scripted. Let’s take a look.

Network Installation

First, download the TP2 ISO from the link above and extract the contents in a convenient location.  Files will need to be copied to a few different destinations, depending on how you have your PXE boot server set up.

The boot files, as with other Linux distributions, are served up via tftp.  Place initrd.img and vmlinuz in a suitable subdirectory of tftpboot.

The RPM package repository (the “RPMS” directory on the ISO) must be served through HTTP, typically in a location resembling /var/www/html/photontp2-RPMS/.

After those files are in place, edit the PXE menu (e.g., pxelinux.cfg/default) to add an entry reflecting the locations in your environment:

label photontp2
menu label Install Photon OS TP2 - Interactive
kernel photontp2/vmlinuz
append initrd=photontp2/initrd.img root=/dev/ram0 loglevel=3 repo=http://10.136.0.10/photontp2-RPMS

From there you can install manually over the network after booting an empty VM.  The full installation should take less than a minute, it’s very small!

Scripted Installation

Once the manual PXE installation is working in your environment, it’s easy enough to automate the process.  Photon OS TP2 supports a simple scripted install, kind of like kickstart.  There are a few differences, though.  The most obvious is the format – instead of a plain text file, TP2 uses JSON.  This is easy enough to edit by hand, but would also facilitate automation in the future if necessary for your use case.

The scripted install file must also be served through HTTP, so place it on an accessible server in a location such as: /var/www/html/ks/photon_tp2_crypt.cfg.

There are sample configuration files included with the distribution and below you see the various elements that can be customized.

Photon OS TP2 scripted installation file

The file above should be fairly self-explanatory, but let’s walk through the highlights:

  • The root password can be specified in plain text or via encryption hash
  • Install type can be minimal (includes Docker) or full
  • Additional packages can be specified by adding elements to that JSON array
  • Post install allows running of a simple script at the conclusion – add a comma and more elements as needed
    • Note that in this sample I am using the systemctl command that enables the Docker service on boot
  • Public key is for SSH root login

Create another entry on your PXE menu that points to the installation script, like so:

label photontp2ks
menu label Install Photon OS TP2 - Scripted
kernel photontp2/vmlinuz
append initrd=photontp2/initrd.img root=/dev/ram0 loglevel=3 repo=http://10.136.0.10/photontp2-RPMS ks=http://10.136.0.10/ks/photon_tp2.cfg

Generating a Password Hash

There are several ways to generate a password hash and multiple algorithms are supported. In my environment, SHA-512 with a random salt worked great.  Either copy an existing hash from another system or generate a new one.  One easy way to do this is to use the mkpasswd command, found in the whois package on Ubuntu systems.  If you want an easy way to try it, this Docker container should do the trick:

mkpasswd

Photon OS is a small, fast, container runtime that is optimized for VMware vSphere infrastructure.  Paravirtualized drivers and VMware Tools are included and make setup a snap.  Enhancements in TP2, such as guest OS customization, make Photon OS even more attractive for your container needs.  Network installation and automation are other great additions for operationalizing this open source element of your cloud-native infrastructure.

 

(Visited 1,647 times, 1 visits today)
This entry was posted in Virtualizationism and tagged , , , . Bookmark the permalink.