I am preparing for the workshop in Zurich. I should deploy many LPARs with AIX and Linux. I also must show the participants how to automate the deployments. To do this, I must first prepare an installation server.
You know, it is possible to use AIX NIM to deploy Linux on IBM Power in an automated manner. I wrote about it almost a year ago:
But now I have an x86 server and should do an installation server for Red Hat Enterprise Linux and SUSE Linux Enterprise Server on IBM Power.
Let’s do it!
What do we need?
We need:
DHCP server
TFTP server
HTTP server
The DHCP server provides IP addresses and information on where to find the Linux kernel and booting data for an LPAR. It gets a request from an LPAR and sends TFTP information back.
The TFTP server contains the Linux kernel and the initial RAM filesystem (initrd or initramfs) to boot the LPAR. It also contains GRUB modules to initiate the network boot process and a configuration file with the necessary kernel parameters. The parameters should point to the HTTP server.
The HTTP server contains the complete installation data - packages and configurations. After the kernel and initramfs are loaded, they contact the HTTP server to retrieve the installation configuration and packages.
Package installation
This is the easiest step. As a reminder, I use my favourite Linux distribution - Red Hat Enterprise Linux. If you use something else, you must change the procedure accordingly.
dnf -y install httpd dhcp-server tftp-server
Prepare installation repository
A modern Linux distribution needs ca. 10 GB per DVD image. Let’s say you plan to install only Red Hat Enterprise Linux 9.6 today. But tomorrow, Red Hat publishes Red Hat Enterprise Linux 9.7, and you suddenly need 10GB more space. If you plan to install SUSE Linux Enterprise Server, you will also need an additional 10GB of space. And so on. Take a new disk, as big as you can, and you are in good shape for the next several years.
My disk is called /dev/sdb:
pvcreate /dev/sdb
vgcreate repovg /dev/sdb
I create two logical volumes on it - one for the TFTP data and one for my repository. For the TFTP data, I don’t need too much space.
lvcreate -L2G -n lvtftp repovg
lvcreate -l100%FREE -n lvrepo repovg
Make filesystems and enable their automatic mounting:
kfs.xfs /dev/repovg/lvrepo
mkfs.xfs /dev/repovg/lvtftp
echo '/dev/mapper/repovg-lvrepo /srv/repo xfs defaults,noatime 0 0' >>/etc/fstab
echo '/dev/mapper/repovg-lvtftp /var/lib/tftpboot xfs defaults,noatime 0 0' >>/etc/fstab
Ah, yes, don’t forget to mount them:
systemctl daemon-reload
mkdir -p /srv/repo /var/lib/tftpboot
mount /srv/repo
mount /var/lib/tftpboot
Configure HTTPd
If you live with Red Hat, you must be prepared to configure SELinux. Don’t be afraid! It is easy. We only must set the correct SELinux type on our new directory:
semanage fcontext -a -t httpd_sys_rw_content_t '/srv/repo(/.*)?'
restorecon -Rv /srv
restorecon -Rv /var/lib/tftpboot
The next step is to change /etc/httpd/conf/httpd.conf. Find /var/www/html there and change it to /srv/repo:
DocumentRoot "/srv/repo"
<Directory "/srv/repo">
...
The last step is to enable and start the httpd service:
systemctl enable --now httpd
Configure TFTP
The next step is more difficult. But we start it easily and install the packages first:
dnf -y install grub2-tools-extra grub2-efi-x64-modules grub2-pc-modules
Now is the most challenging step. We must install the package grub2-ppc64le-modules to enable Linux on Power installations.
Unfortunately, you can’t find the package in the standard x86 Linux repository. Even if the package is a “noarch” package and can be installed on any architecture. Still, you can find it only in Red Hat Enterprise Linux for IBM Power, little-endian. I am not aware of other distributions, if the package can be found there.
For Red Hat Enterprise Linux, you must open the Red Hat Customer Portal in your browser, navigate to Downloads, and then find RPM Package Search in the box on the right side. Simply enter the name of the package in the search box, and when it appears, click the NOARCH button. Then, select the version of the package that corresponds to your GRUB 2 version. Check it by issuing on your system:
rpm -qa | grep grub2 | sort
Then download the package and install it like:
dnf -y install ./grub2-ppc64le-modules-2.06-104.el9_6.noarch.rpm
Hint for those of you who are still reading and don’t have access to the Red Hat packages. Try to find the package on pkgs.org.
We have collected all packages and can make the next step - create TFTP netboot directory:
grub2-mknetdir --net-directory /var/lib/tftpboot
restorecon -Rv /var/lib/tftpboot
We no longer need the grub2-ppc64le-modules package and can remove it:
dnf -y erase grub2-ppc64le-modules
If you start complaining that it took so much time to find it, and now we must remove it from the system, you may leave it installed. However, the next time you update your system, the update will likely fail.
Don’t forget to start TFTP:
systemctl enable --now tftp.socket
Configure DHCP
This is likely one of the most straightforward steps, at least initially. We must write /etc/dhcp/dhcpd.conf. We don’t want to write too much into it, but we need information about our networks, gateways, DNS.
This is my example dhcpd.conf:
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 "power-devops.cloud";
subnet 10.0.2.0 netmask 255.255.255.0 {
option domain-name-servers 10.0.2.254;
option broadcast-address 10.0.2.255;
option routers 10.0.2.254;
default-lease-time 14400;
max-lease-time 28800;
if substring(vendorclass, 0, 9)="PXEClient" {
if pxetype=00:06 or pxetype=00:07 {
filename "boot/grub2/x86_64-efi/core.efi";
} else {
filename "boot/grub2/i386-pc/core.0";
}
}
pool {
range 10.0.2.101 10.0.2.200;
}
next-server 10.0.2.20;
}
I think you can remove half of it. But let the first two options stay in the file. They are important for IBM Power.
Again, start the service:
systemctl enable --now dhcpd.service
Firewall
It is just a small note for me. Yes, I read my newsletters too.
I use Red Hat Enterprise Linux, and it is installed by default with FirewallD. I must enable the services:
firewall-cmd --add-service=tftp
firewall-cmd --add-service=http
firewall-cmd --runtime-to-permanent
Copy installation images
We prepared our installation server. But we need our Linux distributions. Otherwise, we don’t have anything to install!
I hope you have something like rhel-9.6-x86_64-dvd.iso and SLE-15-SP7-Full-ppc64le-GM-Media1.iso. If you don’t have them, stop reading and download them first!
I downloaded my images into /srv/repo/iso, and now I simply mount them:
echo '/srv/repo/iso/rhel-9.6-ppc64le-dvd.iso /srv/repo/RHEL/9.6-ppc64le iso9660 ro,loop 0 0' >> /etc/fstab
echo '/srv/repo/iso/SLE-15-SP7-Full-ppc64le-GM-Media1.iso /srv/repo/SLES/15.7-ppc64le iso9660 ro,loop 0 0' >> /etc/fstab
Of course, we need directories to mount:
mkdir -p /srv/repo/RHEL/9.6-ppc64le
mkdir -p /srv/repo/SLES/15.7-ppc64le
Mount them:
systemctl daemon-reload
mount /srv/repo/RHEL/9.6-ppc64le
mount /srv/repo/SLES/15.7-ppc64le
The next step is to copy the netboot kernel and initramfs to the TFTP server.
First, we create directories:
mkdir -p /var/lib/tftpboot/rhel/9.6-ppc64le
mkdir -p /var/lib/tftpboot/sles/15.7-ppc64le
Copy the kernels and the initramfs:
cp -v /srv/repo/RHEL/9.6-ppc64le/ppc/ppc64/* /var/lib/tftpboot/rhel/9.6-ppc64le/
cp -v /srv/repo/SLES/15.7-ppc64le/boot/ppc64le/{linux,initrd} /var/lib/tftpboot/sles/15.7-ppc64le/
Kickstart and AutoYAST files
If you don’t want to have an automated install, you may skip the session. Otherwise, you can still skip it, because it will be very short.
Kickstart and AutoYast makes it possible to install RHEL or SLES completely automated, without any human intervention. But you must first write them.
I have already posted examples of Kickstart and AutoYast files. If you don’t have yours, you can use mine and modify them to suit your needs.
Create a directory on your web server and put the files into it. My directory is called ks:
mkdir -p /srv/repo/ks
GRUB configuration
The last step is to create the GRUB configuration files. You can create a generic grub.cfg file in the directory /var/lib/tftpboot/boot/grub2/powerpc-ieee1275, like:
echo "Welcome to the Linux on IBM Power installer!"
echo ""
set timeout=60
menuentry 'Install Red Hat Enterprise Linux 9.6' --class fedora --class gnu-linux --class gnu --class os --id rhel96 {
linux (tftp,10.0.2.2)/rhel/9.6-ppc64le/vmlinuz ro ip=dhcp inst.repo=http://10.0.2.2/RHEL/9.6-ppc64le/
initrd (tftp,10.0.2.2)/rhel/9.6-ppc64le/initrd.img
}
menuentry 'Install SUSE Linux Enterprise Server 15.7' --class opensuse --class gnu-linux --class gnu --class os --id sles157 {
linux (tftp,10.0.2.2)/sles/15.7-ppc64le/linux ro ip=dhcp install=http://10.0.2.2/SLES/15.7-ppc64le/
initrd (tftp,10.0.2.2)/sles/15.7-ppc64le/initrd
}
Or you can create grub.cfg files for each of your servers. Get an IP address for your server, convert it to hexadecimal, and append it to grub.cfg. For example, if you have an IP address 10.0.3.3 it will be 0A000303, and the file name will be grub.cfg-0A000303.
To make the installation automatable, add the option for the kickstart file:
echo "Welcome to the Linux on IBM Power installer!"
echo ""
set timeout=60
menuentry 'Install Red Hat Enterprise Linux 9.6' --class fedora --class gnu-linux --class gnu --class os --id rhel96 {
linux (tftp,10.0.2.2)/rhel/9.6-ppc64le/vmlinuz ro ip=dhcp inst.repo=http://10.0.2.2/RHEL/9.6-ppc64le/ inst.ks=http://10.0.2.2/ks/myserver.ks
initrd (tftp,10.0.2.2)/rhel/9.6-ppc64le/initrd.img
}
or to AutoYast:
menuentry 'Install SUSE Linux Enterprise Server 15.7' --class opensuse --class gnu-linux --class gnu --class os --id sles157 {
linux (tftp,10.0.2.2)/sles/15.7-ppc64le/linux ro ip=dhcp install=http://10.0.2.2/sles/ppc64le/15.7/ autoyast=http://10.0.2.2/ks/myserver.xml
initrd (tftp,10.0.2.2)/sles/15.7-ppc64le/initrd
}
Support the Power DevOps Newsletter!
If you like reading technical articles about IBM Power, AIX, and Linux on IBM Power, consider upgrading to the paid tier to show your support. As a paid subscriber, you not only get regular posts, but you will get additional posts with the full code and further explanations, access to the whole archive of the blog, and take part in our monthly calls where you can ask your questions and propose topics for future newsletters. Be an active member of our community!
I almost finished the newsletter…
But then I remembered that we need to add our future server to the dhcpd.conf file. Of course, you can use DHCP OMAPI and omshell to make the process completely automated and eliminate any manual editing of the configuration file. But I will do it in the good old way:
host HOSTNAME { hardware ethernet 0x:00:0x:0x:0x:0x; fixed-address 10.0.3.3; filename "boot/grub2/powerpc-ieee1275/core.elf"; }
Don’t forget to restart dhcpd after you change the configuration file.
Now you are ready to start your installation!
Have fun installing Linux on IBM Power!
Andrey
Hi, I am Andrey Klyachkin, IBM Champion and IBM AIX Community Advocate. This means I don’t work for IBM. Over the last twenty years, I have worked with many different IBM Power customers all over the world, both on-premise and in the cloud. I specialize in automating IBM Power infrastructures, making them even more robust and agile. I co-authored several IBM Redbooks and IBM Power certifications. I am an active Red Hat Certified Engineer and Instructor.
Follow me on LinkedIn, Twitter and YouTube.
You can meet me at events like IBM TechXchange, the Common Europe Congress, and GSE Germany’s IBM Power Working Group sessions.