Outils pour utilisateurs

Outils du site


tech:notes_install_silencieuse_redhat_kickstart

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
tech:notes_install_silencieuse_redhat_kickstart [2025/11/09 19:14] Jean-Baptistetech:notes_install_silencieuse_redhat_kickstart [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon Redhat EFI}}
 +
 +# Notes install silencieuse RedHat KickStart
 +
 +Voir :
 +* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-putkickstarthere.html
 +* https://access.redhat.com/documentation/en/red-hat-enterprise-linux/7/paged/anaconda-customization-guide/2-working-with-iso-images
 +* https://blog.entek.org.uk/notes/2023/04/06/graphical-progress-feedback-for-red-hat-and-rocky-kickstart-post-scripts.html
 +
 +Voir aussi
 +* [[notes_cobbler|Cobbler]]
 +* Preseed [[debian_preseed_install_automatique_par_fichier_de_reponse]]
 +* [[Live-usb]]
 +
 +
 +Voir `/root/anaconda-ks.cfg`
 +
 +`ks.cfg`
 +~~~
 +#bootloader --location=mbr --boot-drive=sda --append="hpsa.hpsa_allow_any=1"
 +bootloader --location=mbr --boot-drive=sda --append="biosdevname=0 net.ifnames=0"
 +
 +clearpart --all --initlabel
 +ignoredisk --only-use=sda
 +zerombr
 +
 +## Allow anaconda to partition the system as needed
 +##autopart --type=lvm
 +#part /boot --fstype="ext4"  --ondisk=sda --asprimary --size=256
 +##part swap                                --asprimary --size=4096
 +#part pv.01 --fstype="lvmpv" --ondisk=sda --asprimary --size=200  --grow
 +#volgroup vg_sys        --pesize=4096 pv.01
 +#logvol /home   --fstype="xfs" --name=lv_home  --vgname=vg_sys --size=1024
 +#logvol /       --fstype="xfs" --name=lv_root  --vgname=vg_sys --size=5120
 +#logvol swap    --fstype swap  --name=lv_swap  --vgname=vg_sys --recommended
 +##logvol        /app    --fstype="xfs" --name=lv_app   --vgname=vg_sys --size=200      --grow
 +
 +# La partition ESP pour les machines EFI aura une taille minimale de 500 Mio au lieu de 200 Mio
 +part /boot/efi --fstype="efi" --ondisk=sda --size=1024 --fsoptions="umask=0077,shortname=winnt"
 +
 +part /boot --fstype="xfs" --ondisk=sda --size=1024
 +part pv.10 --fstype="lvmpv" --ondisk=sda --size=184401
 +volgroup rhel --pesize=4096 pv.10
 +logvol /home  --fstype="xfs" --size=5000 --name=home --vgname=rhel
 +logvol swap  --fstype="swap" --size=3200 --name=swap --vgname=rhel
 +logvol /  --fstype="xfs" --size=102400 --name=root --vgname=rhel
 +
 +firewall --disabled
 +selinux --disabled
 +firstboot --disable
 +
 +keyboard --vckeymap=fr-oss --xlayouts='fr (oss)'
 +lang fr_FR.UTF-8
 +timezone Europe/Paris --isUtc
 +
 +text
 +reboot
 +install
 +skipx
 +
 +auth --enableshadow --passalgo=sha512
 +
 +rootpw --iscrypted $6$16qezferzg55SAL$vnD4POyadqj7x27GUWARljI6.rgezBlTK/7fzsRj9C2S43jONnWDzMSOOMGulsay2YFeIl.
 +user --name=dev --password=$6$W8NI3UWFLLZOZOZJO8pZoyn5oH0LNtveNEWtP.WL5.LTwGDS1bmFwBHSbci.3yB491 --iscrypted --gecos="dev"
 +
 +%pre
 +#%pre --erroronfail
 +
 +set -x -v
 +exec 1>/tmp/ks-pre.log 2>&1
 +
 +# Once root's homedir is there, copy over the log.
 +while : ; do
 +    sleep 10
 +    if [ -d /mnt/sysimage/root ]; then
 +        cp /tmp/ks-pre.log /mnt/sysimage/root/
 +        logger "Copied %pre section log to system"
 +        break
 +    fi
 +done &
 +%end
 +
 +services --enabled=sshd,network --disabled=NetworkManager,dhcdbd
 +
 +%packages
 +@core
 +chrony
 +%end
 +
 +%post --nochroot
 +set -x -v
 +exec 1>/mnt/sysimage/root/ks-post-nochroot.log 2>&1
 +%end
 +
 +%post
 +set -x -v
 +exec 1>/root/ks-post.log 2>&1
 +
 +# Start yum configuration
 +#curl "http://192.168.100.159/cblr/svc/op/yum/system/test02" --output /etc/yum.repos.d/cobbler-config.repo
 +
 +cd /root
 +mkdir --mode=700 .ssh
 +cat >> .ssh/authorized_keys <<EOF
 +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOpSuQISNltnRl5e2lBZ+poH68lY+pMewPOsLM6wvRo9uvEdLgLZBBoYDLgoNhZwT1wvPQSAn7AbHZhmarX3kGlp/0G2yGGzlsn0820KuqLG4Q9ert2x3lg/oeBN4SkbGNplf6QOLN4q2u/z6PJ60I6OyGnA2yEyHekY5fVYjvyXcRMriJrthbdt7hBcwvNAZldzco36gSNhhe4E9WnsVp19jZvjpesEI2jhXBBgk3ewao3sdDnH+LE5rj3VP0bYlgoErDoKlUlSspKmtd16CPvBn0a38msQlj89JxvbC2TrkTOoxQPzXEkuQOXicTxo3E8bvm5EvKXWb0bBYUTtvf jibe@debian2.localdomain
 +EOF
 +chmod 600 .ssh/authorized_keys
 +
 +echo "myhostname.localdomain" > /etc/hostname
 +#network --hostname=myhostname
 +rpm -e biosdevname
 +
 +cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-eth0
 +TYPE=Ethernet
 +BOOTPROTO=dhcp
 +#DEFROUTE=yes
 +IPV6INIT=no
 +IPV4_FAILURE_FATAL=no
 +NAME=eth0
 +DEVICE=eth0
 +ONBOOT=yes
 +NM_CONTROLLED=no
 +EOF
 +
 +# End final steps
 +%end
 +~~~
 +
 +
 +### Vérif
 +
 +~~~bash
 +yum install pykickstart
 +
 +# ou
 +pip install pykickstart
 +~~~
 +
 +~~~bash
 +ksvalidator ks.cfg
 +~~~
 +
 +
 +## Lancer le kickstart placé sur un serveur Web
 +
 +~~~
 +linux ks=http://172.18.21.1/redhat/ks.cfg ip=192.168.0.100 gw=192.168.254.254 dns=192.168.0.2 ksdevice=eth0
 +~~~
 +
 +
 +## Inclure le fichier kickstart dans l'iso
 +
 +Pour boot si BIOS non UEFI
 +~~~bash
 +mount -o ro /dev/cdrom /mnt/iso/
 +rsync -a -H --delete --chmod=u+w /mnt/iso/ /tmp/ks/iso/
 +umount /mnt/iso/
 +
 +vim /tmp/ks/iso/isolinux/isolinux.cfg
 +cp -p /tmp/ks/ks.cfg /tmp/ks/iso/
 +~~~
 +
 +`isolinux/isolinux.cfg`
 +~~~
 +label linux
 +  menu label ^Install Red Hat Enterprise Linux 7.0 - ks (label)
 +  menu default
 +  kernel vmlinuz
 +  #append initrd=initrd.img inst.stage2=hd:sdb2:/ ks=hd:sdb1:/ks.cfg
 +  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.0\x20Server.x86_64 ks=hd:LABEL=RHEL-7.0\x20Server.x86_64:/ks.cfg biosdevname=0 net.ifnames=0
 +
 +label linux
 +  menu label ^Install Red Hat Enterprise Linux 7.0 - ks (cdrom)
 +  kernel vmlinuz
 +  append initrd=initrd.img inst.stage2=cdrom ks=cdrom:/ks.cfg
 +
 +label linux
 +  menu label ^Install Red Hat Enterprise Linux 7.0
 +  kernel vmlinuz
 +  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.0\x20Server.x86_64 quiet
 +
 +~~~
 +
 +Pour UEFI
 +
 +`grub.cfg`
 +~~~bash
 +### BEGIN /etc/grub.d/10_linux ###
 +menuentry 'Install Red Hat Enterprise Linux 7.2' --class fedora --class gnu-linux --class gnu --class os {
 +        linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.2\x20Server.x86_64 quiet
 +        initrdefi /images/pxeboot/initrd.img
 +}
 +menuentry 'KickStart install' --class fedora --class gnu-linux --class gnu --class os {
 +        linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.2\x20Server.x86_64 ks=hd:LABEL=RHEL-7.2\x20Server.x86_64:/ks1.cfg
 +        initrdefi /images/pxeboot/initrd.img
 +}
 +~~~
 +
 +Modif de **efiboot.img**
 +~~~bash
 +mkdir /mnt/tmp
 +mount images/efiboot.img /mnt/tmp/
 +vim /mnt/tmp/EFI/BOOT/grub.cfg
 +umount /mnt/tmp
 +~~~
 +
 +~~~bash
 +cd /tmp/ks/iso/
 +genisoimage  -iso-level 4 -U -r -v -T -J -joliet-long -V "RHEL-7.0 Server.x86_64" -volset "RHEL-7.0 Server.x86_64" -A "RHEL-7.0 Server.x86_64" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -o /tmp/ks/rh7-ks.iso .
 +isohybrid -u /tmp/ks/rh7-ks.iso
 +implantisomd5 /tmp/ks/rh7-ks.iso
 +~~~
 +
 +Note : le parametre suivant va ensemble `-eltorito-alt-boot -e images/efiboot.img`
 +
 +
 +## Autres
 +
 +
 +
 +La petite partition /boot dédiée sur le disque local est formatée usuellement en ext2 (ou FAT32 dans le cadre d’un système UEFI).
 +
 +
 +### Se passer de Grub
 +
 +Voir :
 + * `bootloader --sdboot` et `inst.sdboot` 
 +  * https://linuxfr.org/news/la-longuement-desiree-fedora-linux-39-est-disponible
 +
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki