ISO文件的创建幻环境:CentOS 6.6
kickstart文件如下(路径为/tmp/myiso/isolinux/myks.cfg)):
#platform=x86, AMD64, or Intel EM64T #version=DEVEL #Firewall configuration firewall --enabled --service=ssh # Install OS instead of upgrade install # Use network installation url --url="http://mirrors.aliyun.com/centos/6/os/x86_64/" repo --name="CentOS" --baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/ --cost=100 # Root password rootpw --iscrypted $6$D1i7tCUiBbccTqSt$rCScU5/vhjPkjVZjerK7xEFyyyF51X5x3ZcaiENu3nZYPVoFwg344XQfBVikgBFk2Fb6u1b2ai.kszzLGeLa51 # System authorization information auth --useshadow --passalgo=sha512 # Use text mode install text firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Installation logging level logging --level=info # Reboot after installation reboot --eject # System timezone timezone Asia/Shanghai # Network information network --bootproto=dhcp --device=eth0 --onboot=yes # System bootloader configuration bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda" # Partition clearing information clearpart --drives=sda --all # Disk partitioning information part /boot --fstype="ext4" --size=200 part pv.008001 --size=51200 volgroup vg0 --pesize=8192 pv.008001 logvol / --fstype="ext4" --name=root --vgname=vg0 --size=10240 logvol swap --name=swap --vgname=vg0 --size=2048 logvol /var --fstype="ext4" --name=var --vgname=vg0 --size=20480 %packages @base @console-internet @core @debugging @directory-client @java-platform @network-file-system-client @scientific @security-tools @workstation-policy %end
kickstart文件可以通过原有模板修改,也可已通过system-config-kickstart工具来制作
下面是isolinux.cfg文件(路径为/tmp/myiso/isolinux/isolinux.cfg):
default vesamenu.c32 #prompt 1 timeout 600 display boot.msg menu background splash.jpg menu title Welcome to CentOS 6! menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=cdrom:/isolinux/myks.cfg label vesa menu label Install system with ^basic video driver kernel vmlinuz append initrd=initrd.img xdriver=vesa nomodeset label rescue menu label ^Rescue installed system kernel vmlinuz append initrd=initrd.img rescue
目录树如下:
切换到/tmp目录下开始制作ISO文件:
~]# cd /tmp
tmp]# mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V 'CentOS 6.5-x86_64 boot' -b isolinux/isolinux.bin -c isolinux/boot.cat -o /root/boot-1.0.0.iso /tmp/myiso/
ISO文件制作完成后,保存在了/root目录下
~]# ls /root
现在测试所制作的文件,设置计算的第一启动项为DVD/CDROM,然后开机即可,等待安装完成并自动重启,输入用户名与密码登录即可。
期间创建完kickstart文件之后需要检查其语法是否正确,可使用ksvalidator命令
~]# ksvalidator /PATH/TO/KICKSTART_FIEL