CentOS 6.4 kickstart訂製企業級操作系統專屬光盤

CentOS 6.4 訂製企業級操作系統專屬光盤

訂製思路:

使用kickstart生成自動應答文件,可能你做過使用kickstart 通過網絡自動安裝。現在我們的做法是把自動應用文件寫入到光盤,通過光盤怎麼部署企業級操作系統。

訂製目的:

自動化安裝企業級的操作系統。

需求分析:

1.安裝過程需要你手動交互

2.CentOS 6開始,文本安裝是不能手動分區的,如果是圖形安裝,對於遠程安裝操作系統來說,操作非常痛苦。

3.使用DVD安裝,即使你使用minimal安裝,可能還不能滿足你的需求,感覺包還是很多。我們公司的操作系統是不允許使用vi的,只允許使用sed,所以只能自己定製光盤了


CentOS 6.4 Mini 光盤下載鏈接:

http://centos.arcticnetwork.ca/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso


訂製步驟:

Step1: 掛載mini光盤到本地目錄,用於調整。

# mkdir /opt/centos6.4

# mount /dev/cdrom /media/

# cp -arf /media/. /opt/centos6.4/ #注意這裏是. 而不是* 如果是*號的話,隱藏文件是不會拷貝過去的。


Step2: 編輯ks.cfg文件,些文件可以用system-config-kickstart生成


# vim /opt/centos6.4/isolinux/ks.cfg

# Kickstart file automatically generated by anaconda.

#version=DEVEL

install

cdrom

lang en_US.UTF-8

keyboard us

network --onboot yes --device eth0 --bootproto static --ip 192.168.0.2 -- netmask 255.255.255.0 --gateway 192.168.0.1 --noipv6 --nameserver 192.168.6.200 --hostname minisys

rootpw -- iscrypted $6$PYlQysGL4L.ffkhZ$Ji1NP6wP0wERjiQATmHnbX

#Use text mode install

text

firstboot --disable

# Reboot after installation

reboot

firewall --disabled

authconfig --enableshadow --passalgo=sha512

selinux --disabled

timezone Asia/Shanghai

bootloader --location=mbr --md5pass="$1$0.fOz0Lx$roMC.zg3TE/3N5HPJnOvR0" --append="crashkernel=auto rhgb quiet"

# 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 --initlabel

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

part swap --grow --maxsize=4096 --size=2048

part / --fstype=ext4 --grow --size=1


%packages --nobase

@core

-libselinux

-selinux-policy-targeted

-selinux-policy

-libselinux-utils

-vim-minimal

-dhclient

%end

#@代表要安裝的包組,-代表不安裝


Step3: 修改isolinux.cfg 使其應用ks.cfg文件。

# vim /opt/centos6.4/isolinux/isolinux.cfg

18 label linux

19 menu label ^Install or upgrade an existing system

20 menu default

21 kernel vmlinuz

22 append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img


# 行號代表大概位置,主要更改append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img


Step4:安裝mkisofs 用於打包成光盤

# yum install -y mkisofs #安裝mkisofs軟件包,用於製作.iso光盤文件

# cd /opt

mkisofs -o /MiniCentOS6.4.iso -J -r -v -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "Centos6.4 Mini install" /opt/centos6.4


#mkisofs具體參數意義,請mkisofs --help


ERROR整理:

ERROR1:

Unable to read package metadata. This may be due to a missing repodata directory. Please ensure that your install tree has been correctly generated.

cannot find a valid baseurl for repo:CentOS

解決方法:

去掉光盤isolinux/ks.cfg裏面的這行:

repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100


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