User Tools

Site Tools


linux:centos_redhat_pxe

Deployment on CentOS/Redhat PXE Kickstart

Linux Deployment from PXE server

Procédure PXE création VM Linux

Connect to lnx80

2 files contains the hostnames and IP

/var/www/html/pub/ks.cfg
/etc/dhcp/dhcpd.conf

HTTP repository

Here we are using http to access the repository directory for the install.

Into base http folder create a new folder with version of OS, and make a copy of the files included in the ISO DVD (also hidden files .<file>)

[root@lnx80 html]# mkdir /var/www/html/Centos8/

DHCP configuration

Here set the client IP and the MAC address, which can be find into boot menu of partition option 2

[root@lnx80 grub2]# cat /etc/dhcp/dhcpd.conf
[root@lnx80 pub]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp-server/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

subnet 10.10.0.0 netmask 255.255.0.0
{
allow bootp;
option routers 10.10.0.254;

#ddns-update-style interim;
#ignore client-updates;
authoritative;
allow booting;
allow bootp;
#allow unknown-clients;

group { #BOOTP POWER clients
filename "boot/grub/powerpc-ieee1275/core.elf";

host client1 {
hardware ethernet 06:e4:d5:33:22:22;
fixed-address 10.10.10.100;
}

}
}

Create ressource for TFTPBOOT

Optional, if the PXE server runs on an x86 machine, the grub2-ppc64-modules must be installed

[root@lnx80 ~]# yum install grub2-ppc64-modules

Create a GRUB network boot directory inside the tftp root

[root@lnx80 ~]# cd /var/lib/tftpboot/
[root@lnx80 ~]# cp /var/www/html/Centos8/boot /var/lib/tftpboot/
[root@lnx80 ~]# cp /var/www/html/Centos8/ppc /var/lib/tftpboot/

Create a GRUB configuration file: /var/lib/tftpboot/boot/grub/grub.cfg

Add the option for noprompt during install

[root@lnx80 grub2]# cat /var/lib/tftpboot/boot/grub/grub.cfg
set default=0
set timeout=5
echo -e "\nWelcome to the Centos 8
installer!\n\n"
menuentry 'Centos 8' {
linux /ppc/ppc64/vmlinuz ro ip=dhcp inst.ks=http://10.10.10.80/pub/ks.cfg noprompt
initrd /ppc/ppc64/initrd.img
}

HTTP kickstart file

The kickstart config is located in:

/var/www/html/pub/ks.cfg

Create a kickstart file to automate the deployment:

[root@lnx80 pub]# cd /var/www/html/pub
[root@lnx80 pub]# ll
-rw-r--r-- 1 root root 2092 Jun 14 18:14 ks.cfg
[root@lnx80 pub]# cat ks.cfg
#version=RHEL8
ignoredisk --only-use=mpatha,sda,sdc,sdd,sdb,sdf,sdg,sde,sdh
# System bootloader configuration
bootloader --append="rhgb quiet  crashkernel=auto" --location=mbr --boot-drive=mpatha
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --none --initlabel
# Reboot after installation
reboot
# Use graphical install
#graphical
#vnc
text
repo --name="appstream" --baseurl=http://10.10.10.80/Centos8/AppStream
# Use network installation
url --url="http://10.10.10.80/Centos8/BaseOS"
# Keyboard layouts
# old format: keyboard us
# new format:
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=env2 --interfacename=env2 --activate --ipv6=auto 
network  --bootproto=dhcp --device=env3 --interfacename=env3 --onboot=off --noipv6
network  --hostname=lnx100
# Root password
rootpw --iscrypted $6$ci1aaasiBmU$fko/4zLgIGBumF8p.Jp1nndgZ0

# System authorization information
auth --passalgo=sha512 --useshadow
# SELinux configuration
selinux --disabled
firstboot --disable
# Do not configure the X Window System
skipx
# System services
services --enabled="chronyd"
services --disabled="libvirtd"
# System timezone
timezone Europe/Luxembourg --isUtc


# Disk partitioning information
ignoredisk --only-use=mpatha
clearpart --all --initlabel --drives=mpatha

part pv.590 --fstype="lvmpv" --ondisk=mpatha --size=16392 --grow
part prepboot --fstype="prepboot" --ondisk=mpatha --size=10
part /boot --fstype="xfs" --ondisk=mpatha --size=1005
volgroup rootvg --pesize=4096 pv.590
logvol / --fstype="xfs" --size=3072 --name=root --vgname=rootvg
logvol /usr --fstype="xfs" --size=3072 --name=usr --vgname=rootvg
logvol /var --fstype="xfs" --size=3072 --name=var --vgname=rootvg
logvol /tmp --fstype="xfs" --size=1024 --name=tmp --vgname=rootvg
logvol /home --fstype="xfs" --size=1024 --name=home --vgname=rootvg
logvol swap --fstype="swap" --size=2048 --name=swap --vgname=rootvg

%packages
@^server-product-environment
kexec-tools
wget
curl

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

Restart deamon

Demon xinetd doesn't exist, so restart the following

[root@lnx80 ~]# systemctl restart dhcpd
[root@lnx80 ~]# systemctl restart httpd
[root@lnx80 ~]# systemctl restart tftp

example of ks.cfg

ERROR

Image CentOS 8.2 and 8.3

Missing packages during install

[   75.575449] dracut-initqueue[1030]: curl: (22) The requested URL returned error: 404 Not Found
[   75.577717] dracut-initqueue[1030]: Warning: Downloading 'http://10.10.10.80/Centos8.3/BaseOS/images/install.img' failed!
[   75.586434] dracut-initqueue[1030]:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[   75.586698] dracut-initqueue[1030]:                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[   75.587445] dracut-initqueue[1030]: curl: (22) The requested URL returned error: 404 Not Found
[   75.589777] dracut-initqueue[1030]: Warning: Downloading 'http://10.10.10.80/Centos8.3/BaseOS/LiveOS/squashfs.img' failed!
[   75.590063] dracut-initqueue[1030]: Warning: anaconda: failed to fetch stage2 from http://10.10.10.80/Centos8.3/BaseOS

Solution : It is not possible to deploy centos > V8.0 by PXE. You have to deploy 8.0 and then to update it to 8.4

RedHat Error

During install :

[  108.945532] dracut-initqueue[947]: curl: (23) Failed writing body (4200 != 16384)
[  109.061841] loop: module loaded
[  109.480973] dracut: FATAL: Failed to find a root filesystem in /tmp/curl_fetch_url1/install.img.
[  109.481002] dracut: Refusing to continue
[  109.480523] dracut-initqueue[947]: mount: /run/initramfs/squashfs: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
[  109.480931] dracut-initqueue[947]: /lib/dracut-lib.sh: line 465: echo: write error: No space left on device

Cause : Since the root filesystem is not yet mounted, it would be loading it into a RAM disk. At this point the installer UI is not started yet, and the local disks haven't been touched at all, although the kernel has detected that /dev/vda is present.

Solution : increase allocated RAM on LPAR.

Optional

[root@lnx80 tftpboot]# grub2-mknetdir --net-directory=/var/lib/tftpboot
Netboot directory for powerpc-ieee1275 created. Configure your DHCP server to point to /var/lib/tftpboot/boot/grub2/powerpc-ieee1275/core.elf
linux/centos_redhat_pxe.txt · Last modified: 2021/10/06 17:39 by manu