Skip to content

Instantly share code, notes, and snippets.

@wixaw
Last active December 15, 2019 13:50
Show Gist options
  • Save wixaw/8cc2e0fb7aed01c8ae10ee44971da5a6 to your computer and use it in GitHub Desktop.
Save wixaw/8cc2e0fb7aed01c8ae10ee44971da5a6 to your computer and use it in GitHub Desktop.
custom USB key Centos 7 Kickstart

Creer un iso custom de centos 8 avec kickstart

( commandes valable avec fedora,rhel )

# Télécharger l'iso
cd /export/ISOs/Centos8/
wget http://fr2.rpmfind.net/linux/centos/8.0.1905/isos/x86_64/CentOS-8-x86_64-1905-dvd1.iso


# Créer espace de travail
mkdir -p /export/c8/makeisofolder/
mkdir -p /mnt/iso

# Monter l'ISO
mount -o loop /export/ISOs/Centos8/CentOS-8-x86_64-1905-dvd1.iso /mnt/iso

# Copier le contenu
rsync -av /mnt/iso/ /export/c8/makeisofolder/

# Ajouter le kickstart
cp /export/c8/ks.cfg /export/c8/makeisofolder/isolinux/

# Modifier le grub loader

label linux
  menu label ^Install CentOS Linux 8.0.1905
  ......
  ......
# devient :
label linux
  menu label ^Install CentOS Linux 8.0.1905 KickStart
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.ks=hd:LABEL=CentOS-8-BaseOS-x86_64:/ks.cfg inst.stage2=hd:LABEL=CentOS-8-BaseOS-x86_64 quiet



# Attention : LABEL=CentOS-8-BaseOS-x86_64 doit correspondre à l'option -V de mkisofs (  -V "CentOS-8-BaseOS-x86_64" ) 

# On génère l'iso
cd /export/c8/makeisofolder/
mkisofs -o /tmp/Centos8_custom.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "CentOS-8-BaseOS-x86_64" -R -J -v -T isolinux/. . 

# On le transforme en iso bootable
isohybrid /tmp/Centos8_custom.iso

# On copy l'iso sur le peripherique USB
dd if=/tmp/Centos8_custom.iso of=/dev/sdb bs=4k

Update

Pour mettre à jour, changer uniquement la version de l'OS

#!/bin/bash
# Ajouter ici les commandes de post install
#version=RHEL8
# Use network installation
install
url --url="http://localrepo/yum/centos/8.0/BaseOS"
# Use graphical install
graphical
# System language
lang fr_FR
# Keyboard layouts
keyboard fr
# Network information
network --bootproto=dhcp --device=link --noipv6 --activate --onboot=on
# System timezone
timezone Europe/Paris --isUtc
# X Window System configuration information
xconfig --startxonboot
# Choix de l'installation de grub
bootloader --location=mbr
# Reboot apres install
reboot
# accord de licence
eula --agreed
%post --nochroot
cd /mnt/sysimage/root/
wget http://localrepo/yum/postinstall/postinstall-CentOS8.tar
tar -xvf postinstall-CentOS8.tar
chroot /mnt/sysimage sh /root/postinstall-CentOS8/install_linux-CentOS8.sh >> /mnt/sysimage/root/install_linux-CentOS8.out
%end
repo --name=appstream --baseurl=http://localrepo/yum/centos/8.0/AppStream
%packages
@additional-devel
@base
@core
@development --optional
@fonts
@gnome-apps
@gnome-desktop --optional
@graphics --optional
@input-methods
@internet-applications --optional
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@office-suite --optional
@performance
@perl-runtime
@print-client --optional
@scientific --optional
kexec-tools
hunspell-fr
libreoffice-langpack-fr
-gnome-initial-setup
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment