天天看點

kickstart自動安裝CD光牒

很多的公司都有需求自動安裝系統下面給大家寫的一些東西希望可以用的到

首先我們需要一個iso鏡像的目錄并在裡面建一個custom的目錄

[[email protected] store_new]# ls -a

.          EULA_es  HighAvailability          RELEASE-NOTES-bn-IN.html  RELEASE-NOTES-ja-JP.html  RELEASE-NOTES-ru-RU.html  RPM-GPG-KEY-redhat-beta

..         EULA_fr  images                    RELEASE-NOTES-de-DE.html  RELEASE-NOTES-kn-IN.html  RELEASE-NOTES-si-LK.html  RPM-GPG-KEY-redhat-release

custom     EULA_it  isolinux                  RELEASE-NOTES-en-US.html  RELEASE-NOTES-ko-KR.html  RELEASE-NOTES-ta-IN.html  ScalableFileSystem

.discinfo EULA_ja  LoadBalancer              RELEASE-NOTES-es-ES.html  RELEASE-NOTES-ml-IN.html  RELEASE-NOTES-te-IN.html  Server

EFI        EULA_ko  media.repo                RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-mr-IN.html  RELEASE-NOTES-zh-CN.html  TRANS.TBL

EULA       EULA_pt  Packages                  RELEASE-NOTES-gu-IN.html  RELEASE-NOTES-or-IN.html  RELEASE-NOTES-zh-TW.html

EULA_de    EULA_zh  README                    RELEASE-NOTES-hi-IN.html  RELEASE-NOTES-pa-IN.html  repodata

EULA_en    GPL      RELEASE-NOTES-as-IN.html  RELEASE-NOTES-it-IT.html  RELEASE-NOTES-pt-BR.html  ResilientStorage

.discinfo 這個檔案很重要需要單獨的拷貝到自己需要做鏡像的目錄下,如果沒有這個檔案的話,會認為CD光牒沒有準備好,會報媒體錯誤!

[[email protected] store_new]# cat .discinfo 

1384196515.415715

Red Hat Enterprise Linux 6.5

x86_64

1

其中Red Hat Enterprise Linux 6.5聲明系統版本,1表示該系統使用了1個CD光牒

前面的工作做完,接下來就是配置kickstart.cfg檔案,該檔案是系統安裝時的參照标準,該檔案需要放在custom目錄下

[[email protected] custom]# ls

kickstart.cfg  mlnx   udev

[[email protected] custom]# cat kickstart.cfg 

#platform=x86, AMD64, or Intel EM64T 
#version=DEVEL 
# Firewall configuration 
firewall --disabled 
# Install OS instead of upgrade 
install 
# Use network installation 
url --url=http://192.168.111.130/cdrom/   #這個選項告訴安裝程式:到伺服器192.168.111.130 的HTTP根目錄下的cdrom 檔案夾下尋找安裝媒體
# Root password 
rootpw --iscrypted $1$ZOmqVPS0$2/R0YMoKfzVSyoFFsig5n0
# System authorization information 
auth  --useshadow  --passalgo=sha512
# Use graphical install 
graphical 
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 
# System timezone 
timezone  --isUtc Asia/Shanghai 
# Network information 
network  --bootproto=dhcp --device=eth0 --onboot=on 
# System bootloader configuration 
key --skip 
bootloader --append="rhgb quiet" --location=mbr --driveorder=sda 
# Clear the Master Boot Record 
zerombr 
# Partition clearing information 
clearpart --all --initlabel 
# Disk partitioning information 
part / --fstype="ext4" --grow --size=1
part swap --fstype="swap" --size=1024 

%packages 
@base

%end      

大家可以拷貝這個kickstart.cfg檔案或者把系統的anaconda-ks.cfg檔案拷貝為kickstart.cfg檔案修改一下裡面的參數就可以使用了

%post是安裝完系統後執行的腳本,一些自己需求的配置可以在這裡執行

配置isolinux/isolinux.cfg

[[email protected] store_new]# cat isolinux/isolinux.cfg 

default ks

prompt 1

timeout 10

display boot.msg

menu background splash.jpg

menu title Welcome to Red Hat Enterprise Linux 6.5!

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

label ks

  kernel vmlinuz

  append ks ks=cdrom:/custom/kickstart.cfg initrd=initrd.img

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

label local

  menu label Boot from ^local drive

  localboot 0xffff

label memtest86

  menu label ^Memory test

  kernel memtest

  append -

[[email protected] store_new]# 

  append ks ks=cdrom:/custom/kickstart.cfg initrd=initrd.img 指定安裝的檔案

封裝系統:

mkisofs -R -b isolinux/isolinux.bin -input-charset utf-8 -c isolinux/boot.cat -V RHEL6.5 -no-emul-boot -boot-load-size 4 -boot-info-table  -o /root/rhel6.5store.iso .

如此一個自定義的自動安裝系統完成了

繼續閱讀