RHEL : HTTP EFI & Legacy Kickstart from ISO

This is a simple guide on how to setup boot-only ISO image that later will use HTTP server as installation source.

HTTP Configuration

1. Download the full DVD ISO image and mount it.
# mount rhel-server-7.4-x86_64-dvd.iso /mnt/isoprep

2. Install the HTTP and allow firewalld service.
# yum install httpd -y
# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload

3. Create document directory to host the installation source.
# mkdir /var/www/html/rhel7

4. Copy the ISO installer to http document directory  (including hidden file).
# cp -ravf /mnt/isoprep/* /var/www/html/rhel7

The directory will look like this:

[root@ocp html]# tree -L 2
.
`-- rhel7
    |-- addons
    |-- EFI
    |-- EULA
    |-- extra_files.json
    |-- GPL
    |-- images
    |-- isolinux
    |-- LiveOS
    |-- media.repo
    |-- my.ks
    |-- Packages
    |-- repodata
    |-- RPM-GPG-KEY-redhat-beta
    |-- RPM-GPG-KEY-redhat-release
    `-- TRANS.TBL

8 directories, 8 files

5. Start the httpd.
# systemctl start httpd

BOOT-ONLY ISO Preparation

1. Next we going to prepare the boot-only ISO. Create a workarea folder
# mkdir /root/workarea/rhel7

2. Copy below files from the source DVD.
# cp -rvf /mnt/isoprep/{EFI,isolinux,images} /root/workarea/rhel7

3. There are two files to be edited to reflect our new installation environment.
/root/workarea/rhel7/EFI/BOOT/grub.cfg --> EFI boot
/root/workarea/rhel7/isolinux/isolinux.cfg --> Legacy boot

4.  For EFI it will look like this.

-- truncated --
search --no-floppy --set=root -l 'RHEL-7.4 Server.x86_64'

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Static ethX' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.ks=http://192.168.0.40/rhel7/my.ks biosdevname=0 net.ifnames=0 ifname=eth0:XX:XX:XX:XX:XX ip=ip::gateway:netmask:hostname:eth0:none nameserver=
initrdefi /images/pxeboot/initrd.img
}

menuentry 'Static ethX bondX' --class fedora --class gnu-linux --class gnu --class os {
        linuxefi /images/pxeboot/vmlinuz inst.ks=http://192.168.0.40/rhel7/my.ks biosdevname=0 net.ifnames=0 ifname=eth0:XX:XX:XX:XX:XX ifname=eth1:XX:XX:XX:XX:XX bond=bondX:eth0,eth1:mode=active-backup ip=ip::gateway:netmask:hostname:bondX:none nameserver=
        initrdefi /images/pxeboot/initrd.img
}


5. For Legacy.

-- truncated --


label static_ethX
  menu label ^Static ethX
  kernel vmlinuz
  append initrd=initrd.img inst.ks=http://192.168.0.40/rhel7/my.ks biosdevname=0 net.ifnames=0 ifname=eth0:macaddr ip=ip::gateway:netmask:hostname:eth0:none nameserver=

label static_ethX_bond
  menu label ^Static ethX bondX
  kernel vmlinuz
  append nitrd=initrd.img inst.ks=http://192.168.0.40/rhel7/my.ks biosdevname=0 net.ifnames=0 ifname=eth0:XX:XX:XX:XX:XX ifname=eth1:XX:XX:XX:XX:XX bond=bondX:eth0,eth1:mode=active-backup ip=ip::gateway:netmask:hostname:bondX:none nameserver=

label returntomain
  menu label Return to ^main menu
  menu exit

menu end

6. Now we are going to create the ISO.

[root@ocp rhel7]# pwd
/root/workarea/rhel7
(reverse-i-search)`m': mkisofs -r -T -J -V "RHEL-7.1 Server.x86_64" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o  /root/workarea/rhel7/rhel-server-7.4-bootonly-x86_64-dvd.iso .

Kickstart preparation

1. To complete the step, we need to provide kickstart file. In this example the kickstart file hosted by http in /var/www/html/rhel7/my.ks. Below are very simple ks file with HDD 20GB required. The rootpw for below is 'redhat123'. Remove EFI part for legacy boot.

Content:

lang en_US
keyboard us
timezone Asia/Jakarta --isUtc
rootpw $1$snOZW7gF$G0k2UQ7837IAAMgtGbiua1 --iscrypted
#platform x86, AMD64, or Intel EM64T
reboot
text
url --url=http://192.168.0.40/rhel7
bootloader --location=mbr --append="crashkernel=auto"
zerombr
clearpart --all --initlabel

# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=1907
part pv.197 --fstype="lvmpv" --ondisk=sda --size=21004
part /boot/efi --fstype="efi" --ondisk=sda --size=1907 --fsoptions="umask=0077,shortname=winnt"
volgroup rhel --pesize=4096 pv.197
logvol /  --fstype="xfs" --size=4768 --name=root --vgname=rhel
logvol /var/log/audit  --fstype="xfs" --size=4768 --name=var_log_audit --vgname=rhel
logvol /home  --fstype="xfs" --size=4768 --name=home --vgname=rhel
logvol swap  --fstype="swap" --size=1907 --name=swap --vgname=rhel
logvol /var  --fstype="xfs" --size=4768 --name=var --vgname=rhel

auth --passalgo=sha512 --useshadow
selinux --enforcing
firewall --enabled
firstboot --disable
%packages
@base
%end


Now you may download the ISO created and mount it. Edit the paramater and execute the boot.




Comments

Popular Posts