kickstart及引導鏡像製作

kickstart及引導鏡像製作

1,掛載系統發行光盤到/mnt目錄下

# mount -o ro /dev/cdrom /mnt/

2,複製系統發行光盤中的isolinux目錄至/tmp/cdrom;

#mkdir /tmp/cdrom

#cp /mnt/isolinux /tmp/cdrom

3,製作kickstart文件ks.cfg文件至/tmp/cdrom下

#安裝system-config-kickstart

#yum install system-config-kickstart -y

4,在命令輸入system-config-kickstart啓動system-config-kickstart GUI界面

wKiom1U3n6Xx5luJAAI8OkA5Mz4790.jpg

 

wKiom1U3n96xu2gqAAG7iXWNngI591.jpg

 

wKioL1U3oVHBLSquAAGLTccCWNI755.jpg

最後生成的ks.cfg

[root@localhost~]# cat ks.cfg

#Kickstart file automatically generated by anaconda.

 

#version=DEVEL

install<--安裝方式

url--url=http://172.16.0.1/cobbler/ks_mirror/CentOS-6.6-x86_64/ <--安裝書的位置;安裝過程中程序包的路徑

langen_US.UTF-8 <--安裝的語言;對中文的支持不是很好哦!

keyboardus <--鍵盤類型

network--onboot yes --device eth0 --bootproto dhcp --noipv6 <--安裝過程中的網絡功能

rootpw  --iscrypted  $6$CGsqab6d$Cd.PnnWtlL5XZAyr9J2zoMqyJH1QodcDp1pQp0uZ1f0Cq4eq9.TMkSQU6IfpvYZEYc32.lmF0lKuQwavnC49a0<--root密碼加密存放

#Reboot after installation

reboot<--安裝完成以後的動作;reboot|poweroff

firewall--disabled <--iptables防火牆 ;--disabled 爲關閉防火牆

authconfig--useshadow  --passalgo=sha512

selinux--disabled <--selinux的設置

timezoneAsia/Shanghai <--時區

bootloader--location=mbr --driveorder=sda --append="crashkernel=auto rhgb rhgb quietquiet"

#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

#clearpart--all <--清除目標磁盤的所有分區

 

part/boot --fstype=ext4 --size=500

partpv.008002 --size=61440

 

volgroupvg0 --pesize=8192 pv.008002

logvol/ --fstype=ext4 --name=root --vgname=vg0 --size=20480

logvolswap --name=swap --vgname=vg0 --size=2048

logvol/usr --fstype=ext4 --name=usr --vgname=vg0 --size=10240

logvol/var --fstype=ext4 --name=var --vgname=vg0 --size=20480

 

 

%packages<--安裝的包組 和軟件包

@Base

@Core

@base

@basic-desktop

@chinese-support

@client-mgmt-tools

@core

@desktop-platform

@fonts

@general-desktop

@graphical-admin-tools

@legacy-x

@network-file-system-client

@perl-runtime

@remote-desktop-clients

@x11

ibus-table-cangjie

ibus-table-erbi

ibus-table-wubi

lftp

tree

%end

 

%post<--安裝後腳本:安裝過程完成之後要執行的腳本;

 

%end

ks.cfg

#Kickstart file automatically generated by anaconda.

 

#version=DEVEL

install<--安裝方式

url--url=http://172.16.0.1/cobbler/ks_mirror/CentOS-6.6-x86_64/ <--安裝書的位置;安裝過程中程序包的路徑

langen_US.UTF-8 <--安裝的語言;對中文的支持不是很好哦!

keyboardus <--鍵盤類型

network--onboot yes --device eth0 --bootproto dhcp --noipv6 <--安裝過程中的網絡功能

rootpw  --iscrypted  $6$CGsqab6d$Cd.PnnWtlL5XZAyr9J2zoMqyJH1QodcDp1pQp0uZ1f0Cq4eq9.TMkSQU6IfpvYZEYc32.lmF0lKuQwavnC49a0<--root密碼加密存放

#Reboot after installation

reboot<--安裝完成以後的動作;reboot|poweroff

firewall--disabled <--iptables防火牆 ;--disabled 爲關閉防火牆

authconfig--useshadow  --passalgo=sha512

selinux--disabled <--selinux的設置

timezoneAsia/Shanghai <--時區

bootloader--location=mbr --driveorder=sda --append="crashkernel=auto rhgb rhgb quietquiet"

#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

#clearpart--all <--清除目標磁盤的所有分區

 

part/boot --fstype=ext4 --size=500

partpv.008002 --size=61440

 

volgroupvg0 --pesize=8192 pv.008002

logvol/ --fstype=ext4 --name=root --vgname=vg0 --size=20480

logvolswap --name=swap --vgname=vg0 --size=2048

logvol/usr --fstype=ext4 --name=usr --vgname=vg0 --size=10240

logvol/var --fstype=ext4 --name=var --vgname=vg0 --size=20480

 

 

%packages<--安裝的包組 和軟件包

@Base

@Core

@base

@basic-desktop

@chinese-support

@client-mgmt-tools

@core

@desktop-platform

@fonts

@general-desktop

@graphical-admin-tools

@legacy-x

@network-file-system-client

@perl-runtime

@remote-desktop-clients

@x11

ibus-table-cangjie

ibus-table-erbi

ibus-table-wubi

lftp

tree

%end

 

%post<--安裝後腳本:安裝過程完成之後要執行的腳本;

 

%end

 

5,編輯/tmp/cdrom/isolinux/isolinux.cfg

[root@localhost~]# cat /tmp/cdrom/isolinux/isolinux.cfg

defaultvesamenu.c32

#prompt1

timeout600

 

displayboot.msg

 

menubackground splash.jpg

menutitle Welcome to CentOS 6.6 Magedu.com ! <--安裝光盤啓動時的提示信息

menucolor border 0 #ffffffff #00000000

menucolor sel 7 #ffffffff #ff000000

menucolor title 0 #ffffffff #00000000

menucolor tabmsg 0 #ffffffff #00000000

menucolor unsel 0 #ffffffff #00000000

menucolor hotsel 0 #ff000000 #ffffffff

menucolor hotkey 7 #ffffffff #ff000000

menucolor scrollbar 0 #ffffffff #00000000

 

labellinux

  menu label ^Install or upgrade an existingsystem

  menu default

  kernel vmlinuz

  append initrd=initrd.img ks=cdrom://ks.cfg<--指定ks文件的存放位置

labelvesa

  menu label Install system with ^basic videodriver

  kernel vmlinuz

  append initrd=initrd.img xdriver=vesanomodeset

labelrescue

  menu label ^Rescue installed system

  kernel vmlinuz

  append initrd=initrd.img rescue

labellocal

  menu label Boot from ^local drive

  localboot 0xffff

labelmemtest86

  menu label ^Memory test

  kernel memtest

  append -

 

6. 創建光盤鏡像        

#mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V"CentOS 6.6 X86_64 boot disk" -b isolinux/isolinux.bin -cisolinux/boot.cat -o /root/boot.iso cdrom/

 

7. 新建虛擬機 實用boot.iso 作爲啓動鏡像

wKiom1U3oBawetvkAAIEK2dPiGE257.jpg


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章