kickstart文件詳解與無人值守裝機

1亭枷、kickstart 文件詳解

anaconda程序安裝系統(tǒng)支持交互式和配置文件方式安裝拢驾;

系統(tǒng)安裝后哼蛆,在/root下就會自動生成其安裝過程中的配置文件anaconda-ks.cfg ,即kickstart文件;

kickstart文件由三段組成命令段(%packages前的)脆丁、程序包段(%packages開始,%end結(jié)束)动雹、腳本段(%pre槽卫,安裝前腳本 ;%post 胰蝠,安裝后腳本)歼培;具體內(nèi)容如下:

#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Install OS instead of upgrade

install? ? ? ? ? ? ? ? ?##安裝系統(tǒng)

# Keyboard layouts

# old format: keyboard us

# new format:

keyboard --vckeymap=us --xlayouts='us'? ##鍵盤類型

# Root password

rootpw --iscrypted $1$3Lr0AjZk$cgK7DTSfd3wiwirdTkjcI1? ? ##設(shè)置root密碼

# Use network installation

url --url="http://mirrors.aliyun.com/centos/7/os/x86_64/"? ? ?##安裝鏡像路徑,此處使用阿里云

# System language

lang en_US? ? ? ? ? ? ?##設(shè)置系統(tǒng)語言

# System authorization information

auth? --useshadow? --passalgo=sha512? ? ##用戶登錄認(rèn)證方式

# Use graphical install

graphical? ? ##設(shè)置使用圖形安裝方式

firstboot --disable? ?##設(shè)置當(dāng)系統(tǒng)啟動時Setup Agent 是否安裝茸塞;默認(rèn)disable

# SELinux configuration

selinux --disabled? ? ? ##設(shè)置默認(rèn)關(guān)閉selinux

# System services

services --disabled="chronyd"? ? ? ##不啟用chronyd服務(wù)躲庄,chronyd是centos7代替ntp服務(wù)的

ignoredisk --only-use=sda? ? ?##當(dāng)有多塊磁盤時,指定安裝使用的磁盤钾虐,其他都忽略?

# Firewall configuration

firewall --disabled? ? ##不起用防火墻

# Network information

network? --bootproto=dhcp --device=ens33? ? ?##配置網(wǎng)卡及獲取IP地址的協(xié)議

# Halt after installation

halt

# System timezone

timezone Asia/Shanghai --nontp? ? ? ??

# System bootloader configuration

bootloader --append="crashkernel=auto" --location=mbr --boot-drive=sda? ? ##設(shè)置bootloader選項

# Clear the Master Boot Record

zerombr? ? ##If zerombr is specified any invalid partition tables found on disks are initialized. This destroys all of the contents of disks with invalid partition tables.

# Partition clearing information

clearpart --all --initlabel? ? ?##Removes partitions from the system, prior to creation of new partitions. By default, no partitions are removed

# Disk partitioning information

part / --fstype="xfs" --size=10240

part /boot --fstype="xfs" --size=500

%packages? ? ? ?##設(shè)置需要安裝的程序包

@^minimal

@core

kexec-tools

net-tools

vim

%end

參考:https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-options.html

2噪窘、圖形界面配置并生成kickstart文件

windows物理機安裝:

xshell

xmanager

linux虛擬機安裝:

>>>yum group install "X Window System" -y

>>>yum install "system-config-kickstart" -y

(vm workstation中的)linux虛擬機運行:

>>>system-config-kickstart? &

會彈出以下界面:

打開anaconda文件進行編輯,

設(shè)置安裝鏡像地址:https://mirrors.aliyun.com/centos/7/os/x86_64/

安裝新boot loader :

創(chuàng)建分區(qū):

設(shè)置網(wǎng)卡名稱及IP地址獲取方式:

用戶登錄認(rèn)證方式:

關(guān)閉防火墻和selinux

安裝圖形界面及是否安裝Setup Agent:

設(shè)置完畢后,另存為/root/ks.cfg?

cat??/root/ks.cfg?

#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Install OS instead of upgrade

install

# Keyboard layouts

# old format: keyboard us

# new format:

keyboard --vckeymap=us --xlayouts='us'

# Root password

rootpw --iscrypted $1$3Lr0AjZk$cgK7DTSfd3wiwirdTkjcI1

# Use network installation

url --url="http://mirrors.aliyun.com/centos/7/os/x86_64/"

# System language

lang en_US

# System authorization information

auth? --useshadow? --passalgo=sha512

# Use graphical install

graphical

firstboot --disable

# SELinux configuration

selinux --disabled

# System services

services --disabled="chronyd"

ignoredisk --only-use=sda

# Firewall configuration

firewall --disabled

# Network information

network? --bootproto=dhcp --device=ens33

# Halt after installation

halt

# System timezone

timezone Asia/Shanghai --nontp

# System bootloader configuration

bootloader --append="crashkernel=auto" --location=mbr --boot-drive=sda

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel

# Disk partitioning information

part / --fstype="xfs" --size=10240

part /boot --fstype="xfs" --size=500

%packages

@^minimal

@core

kexec-tools

net-tools

vim

%end


將以上ks.cfg 放入httpd 服務(wù)器的/var/www/html 下效扫,則訪問地址為:http://192.168.0.140/ks.cfg 倔监;

新建虛擬機,插入光盤菌仁,開啟電源浩习,Tab 鍵進入安裝設(shè)置界面,并輸入:

ip=192.168.0.150 netmask=255.255.255.0 gateway=192.168.0.1 ks=http://192.168.0.140/ks.cfg?

然后繼續(xù)啟動機器济丘,就可以自動安裝系統(tǒng)了谱秽。。摹迷。疟赊。。?

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末泪掀,一起剝皮案震驚了整個濱河市听绳,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌异赫,老刑警劉巖椅挣,帶你破解...
    沈念sama閱讀 216,651評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件头岔,死亡現(xiàn)場離奇詭異,居然都是意外死亡鼠证,警方通過查閱死者的電腦和手機峡竣,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,468評論 3 392
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來量九,“玉大人适掰,你說我怎么就攤上這事≤校” “怎么了类浪?”我有些...
    開封第一講書人閱讀 162,931評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長肌似。 經(jīng)常有香客問我费就,道長,這世上最難降的妖魔是什么川队? 我笑而不...
    開封第一講書人閱讀 58,218評論 1 292
  • 正文 為了忘掉前任力细,我火速辦了婚禮,結(jié)果婚禮上固额,老公的妹妹穿的比我還像新娘眠蚂。我一直安慰自己,他們只是感情好斗躏,可當(dāng)我...
    茶點故事閱讀 67,234評論 6 388
  • 文/花漫 我一把揭開白布逝慧。 她就那樣靜靜地躺著,像睡著了一般瑟捣。 火紅的嫁衣襯著肌膚如雪馋艺。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,198評論 1 299
  • 那天迈套,我揣著相機與錄音捐祠,去河邊找鬼。 笑死桑李,一個胖子當(dāng)著我的面吹牛踱蛀,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播贵白,決...
    沈念sama閱讀 40,084評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼率拒,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了禁荒?” 一聲冷哼從身側(cè)響起猬膨,我...
    開封第一講書人閱讀 38,926評論 0 274
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎呛伴,沒想到半個月后勃痴,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體谒所,經(jīng)...
    沈念sama閱讀 45,341評論 1 311
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,563評論 2 333
  • 正文 我和宋清朗相戀三年沛申,在試婚紗的時候發(fā)現(xiàn)自己被綠了劣领。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,731評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡铁材,死狀恐怖尖淘,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情著觉,我是刑警寧澤村生,帶...
    沈念sama閱讀 35,430評論 5 343
  • 正文 年R本政府宣布,位于F島的核電站固惯,受9級特大地震影響梆造,放射性物質(zhì)發(fā)生泄漏缴守。R本人自食惡果不足惜葬毫,卻給世界環(huán)境...
    茶點故事閱讀 41,036評論 3 326
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望屡穗。 院中可真熱鬧贴捡,春花似錦、人聲如沸村砂。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,676評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽础废。三九已至汛骂,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間评腺,已是汗流浹背帘瞭。 一陣腳步聲響...
    開封第一講書人閱讀 32,829評論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留蒿讥,地道東北人蝶念。 一個月前我還...
    沈念sama閱讀 47,743評論 2 368
  • 正文 我出身青樓,卻偏偏與公主長得像芋绸,于是被迫代替她去往敵國和親媒殉。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,629評論 2 354