kickstart file

  1. kickstart 範例
    [root@dywH add]# cat kvm-ks.cfg
    
    # Kickstart file automatically generated by anaconda.
    #version=RHEL6
    install
    #cdrom
    #url --url=ftp://192.168.122.1/pub/centos6/kvm
    lang en_US.UTF-8
    keyboard us
    network --device=eth0 --mtu=1500 --bootproto=dhcp --hostname=111111
    rootpw  --iscrypted $6$1T62zwS1ovhfGXUW0TGm1JTg1eR8v/P/eKOUvkJmxkQk5ckKd/
    firewall --service=ssh
    authconfig --enableshadow --passalgo=sha512 --enablefingerprint
    selinux --permissive
    timezone --utc Asia/Taipei
    bootloader --location=mbr --driveorder=vda --append="crashkernel=auto"
    # The following is the partition information you requested
    # Note that any partitions you deleted are not expressed
    # here so unless you clear all partitions first, this is
    # not guaranteed to work
    services --disabled=anacron
    reboot
    
    zerombr yes
    clearpart --all
    clearpart --drives=vda
    ignoredisk --only-use=vda
    
    part /boot --fstype=ext4 --size=96
    part pv.01 --size=1100
    part pv.02 --size=130
    volgroup vg_kvmusb --pesize=4096 pv.01
    logvol / --fstype=ext4 --name=root --vgname=vg_kvmusb --size=1000 #--grow
    logvol swap --name=swap --vgname=vg_kvmusb --size=48 #--grow --maxsize=96
    volgroup vg_kvmhome --pesize=2048 pv.02
    logvol /home --fstype=ext4 --name=vo --vgname=vg_kvmhome --size=80 #--grow --maxsize=144
    
    %packages --nobase
    #@core
    %include /tmp/kvmpack
    %end
    
    %pre
    wget --tries=1 ftp://192.168.122.1/pub/centos6/add/gvmpack -O /tmp/kvmpack
    n=$(cat -n /tmp/kvmpack | grep '#kvm_add' | awk '{print $1}')
    a=$(echo $n| sed 's/\ /,/')
    sed -i "${a}d" /tmp/kvmpack
    %end
    
    %post --nochroot
    cp /var/ftp/pub/kvm.html $INSTALL_ROOT/var/ftp/pub
    %end
    
    %post
    rm -f /etc/yum.repos.d/*.repo
    cd /boot/grub
    tf="grub.conf"
    sed -i 's/^title/title KVM/' $tf
    sed -i 's/^splashimage/#splashimage/' $tf
    sed -i 's/^timeout=5/timeout=30/' $tf
    ln -sf grub.conf menu.lst
    %end
    
  2. 驗證 kickstart file 語法是否正確?顯示第 22 行命令 zerombr,不能有任何參數。
    [root@dywH add]# ksvalidator kvm-ks.cfg
    The following problem occurred on line 22 of the kickstart file:
    
    Kickstart command zerombr does not take any arguments
    
  3. 刪除第 25 行命令 zerombr 後的 yes 參數,再驗證。
    [root@dywH add]# sed -i 's/^\(zerombr\).*/\1/' kvm-ks.cfg
    [root@dywH add]# ksvalidator kvm-ks.cfg