Linux technical support - [email protected]


Centos 7 kickstart example

install
lang en_US.UTF-8
keyboard us
timezone --utc Europe/Moscow
auth --useshadow --enablemd5
services --enabled=NetworkManager,sshd
firewall --enabled --ssh
eula --agreed
ignoredisk --only-use=sda
reboot

clearpart --none

bootloader --location=mbr
zerombr

part swap --asprimary --fstype="swap" --size=4096
part /boot --fstype ext4 --size=500
part biosboot --fstype=biosboot --size=1

part pv.01 --size 50000

volgroup rootvg pv.01

logvol /var  --fstype ext4 --name=var  --vgname=rootvg --size=10000
logvol /     --fstype ext4 --name=root --vgname=rootvg --size=1 --grow

# CLEAN ALL PARTITION SCRIPT
%pre --log=/root/my-pre-log
#!/bin/bash

if [[ $(vgdisplay 2> /dev/null | wc -l) > 0 ]]
then
  for vgname in $(vgdisplay |  grep "VG Name" | awk '{print $3}')
  do
    vgchange -a n ${vgname}
# Error: Partition(s) 1,2,4,4 on /dev/sdX have been written, but we have been unable to inform the kernel of the change,
# probably because it/they are in use. Remove volume group
    vgremove -f ${vgname}
  done
fi

for disk in $(parted -l 2> /dev/null | grep -E "Disk \/" | grep -v "\/dev\/mapper" | awk '{print $2}' | sed 's/:.*//')
do
  if [[ $(parted $disk print 2> /dev/null | grep -E "Number\s+Start\s+End" | wc -l) > 0 ]]; then
    for partition in $(parted -s $disk print | awk '/^ / {print $1}')
    do
      parted -s $disk rm $partition
    done
  fi
  /usr/sbin/parted -s $disk mklabel gpt
  partprobe $disk
done

%end

rootpw --iscrypted y7hyyuhuhuaEt9IHn5t3AL94Goq3UL6C8azQuzMT2L7k8uj89u8jupBBncZSeKgA0knKI6ny2n2T/

repo --name=base --baseurl=[YOUR REPO PATH]
url --url="[YOUR REPO PATH]"

%packages --nobase --ignoremissing
@core
%end

 

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>