前言
在大規(guī)模安裝服務(wù)器時(shí),需要批量自動(dòng)化方法來(lái)安裝服務(wù)器,來(lái)減少日常的工作量。
PXE(Pre-boot Execution Environment)是由Intel設(shè)計(jì)的協(xié)議,它可以使計(jì)算機(jī)通過(guò)網(wǎng)絡(luò)而不是從本地硬盤(pán)、光驅(qū)等設(shè)備啟動(dòng)?,F(xiàn)代的網(wǎng)卡,一般都內(nèi)嵌支持PXE的ROM芯片。當(dāng)計(jì)算機(jī)引導(dǎo)時(shí),BIOS把PXE client調(diào)入內(nèi)存執(zhí)行,并顯示出命令菜單,經(jīng)用戶(hù)選擇后,PXE client將放置在遠(yuǎn)端的操作系統(tǒng)通過(guò)網(wǎng)絡(luò)下載到本地運(yùn)行。
本文主要是搭建PXE的完整命令,具體的說(shuō)明我都加到了命令后面進(jìn)行了注釋?zhuān)@里我使用的KVM進(jìn)行的操作,如果有什么不清楚的地方,可以私信我,或者給我發(fā)郵件。
歡迎大家批評(píng)指教,在這里謝謝各位了。
具體實(shí)現(xiàn)
特別注意
本次操作的虛擬機(jī)環(huán)境是將防火墻(iptables)和SeLinux關(guān)閉的情況下進(jìn)行的操作,之前并沒(méi)有意識(shí)到這一點(diǎn),實(shí)在是抱歉。
實(shí)現(xiàn)目標(biāo)
這次會(huì)計(jì)劃實(shí)現(xiàn)的功能有:
- 分配ip地址和對(duì)應(yīng)主機(jī)名
- 裝機(jī)可選擇菜單,可選擇安裝RHEL6或者CentOS6,缺省為RHEL6
- 安裝后執(zhí)行腳本,添加普通用戶(hù),搭建yum,并且安裝vsftpd 服務(wù),并做到隨機(jī)自啟
搭建部署
//安裝配置DNS服務(wù),來(lái)實(shí)現(xiàn)動(dòng)態(tài)分配主機(jī)名
[root@pxe-server-04 ~]# yum -y install bind bind-chroot //安裝DNS服務(wù)包
[root@pxe-server-04 ~]# service named restart //開(kāi)啟DNS服務(wù)
停止 named: [確定]
Generating /etc/rndc.key: [確定]
啟動(dòng) named: [確定]
[root@pxe-server-04 ~]# chkconfig named on //開(kāi)機(jī)自啟
[root@pxe-server-04 ~]# chkconfig named --list //驗(yàn)證結(jié)果
named 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@pxe-server-04 ~]# vim /etc/named.conf
[root@pxe-server-04 ~]# cat /etc/named.conf //配置文件修改如下
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { any; }; //監(jiān)聽(tīng)端口
directory "/var/named"; //地址庫(kù)文件所在目錄
allow-query { any; }; //允許任何客戶(hù)機(jī)查詢(xún)
};
zone "4.168.192.in-addr.arpa" IN { //反向解析配置
type master;
file "192.168.4.arpa";
};
[root@pxe-server-04 ~]# cd /var/named/ //進(jìn)入地址庫(kù)文件目錄
[root@pxe-server-04 named]# ll
total 32
drwxr-x---. 6 root named 4096 Dec 17 09:18 chroot
drwxrwx---. 2 named named 4096 Dec 17 09:20 data
drwxrwx---. 2 named named 4096 Dec 17 09:20 dynamic
-rw-r-----. 1 root named 2075 Apr 23 2014 named.ca
-rw-r-----. 1 root named 152 Dec 15 2009 named.empty
-rw-r-----. 1 root named 152 Jun 21 2007 named.localhost
-rw-r-----. 1 root named 168 Dec 15 2009 named.loopback
drwxrwx---. 2 named named 4096 May 11 2015 slaves
[root@pxe-server-04 named]# cp -p named.localhost 192.168.4.arpa //由于named服務(wù)需要給該配置文件添加named所屬組屬性,所以這里就使用cp -p命令,保留原文將的屬性,拷貝一個(gè)模板來(lái)進(jìn)行修改
[root@pxe-server-04 named]# hostname
pxe-server-04.wolf.com
[root@pxe-server-04 named]# vim 192.168.4.arpa
[root@pxe-server-04 named]# cat 192.168.4.arpa //配置文件修改如下
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS pxe-server-04.wolf.com. //該位置寫(xiě)主機(jī)名即前面hostname的結(jié)果,但是需要以“.”結(jié)尾,請(qǐng)務(wù)必注意,負(fù)責(zé)重啟服務(wù)會(huì)出現(xiàn)報(bào)錯(cuò)
$GENERATE 100-200 $ PTR pc-$.war.cn. //使用函數(shù),生成從100到200連續(xù)的數(shù)字
[root@pxe-server-04 named]# service named restart
停止 named: [確定]
啟動(dòng) named: [確定]
//驗(yàn)證DNS結(jié)果
[root@pxe-server-04 named]# nslookup 192.168.4.102 192.168.4.99 //前一個(gè)IP是驗(yàn)證的IP地址,后一個(gè)IP是當(dāng)前主機(jī)的ip地址,即DNS服務(wù)器的地址
Server: 192.168.4.99
Address: 192.168.4.99#53
102.4.168.192.in-addr.arpa name = pc-102.war.cn.
//安裝,配置DHCP服務(wù)
[root@pxe-server-04 ~]# yum -y install dhcp
[root@pxe-server-04 ~]# chkconfig dhcpd on
[root@pxe-server-04 ~]# chkconfig dhcpd --list
dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@pxe-server-04 ~]# vim /etc/dhcp/dhcpd.conf
[root@pxe-server-04 ~]# cat /etc/dhcp/dhcpd.conf //初始dhcpd服務(wù)主配置文件,沒(méi)有缺省配置,需要我們自己添加
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample //模板文件,可使用r寫(xiě)入
# see 'man 5 dhcpd.conf' //使用man幫助查看該文件
#
//經(jīng)過(guò)修改后文件如下
[root@pxe-server-04 ~]# cat /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
subnet 192.168.4.0 netmask 255.255.255.0 {
range 192.168.4.100 192.168.4.200;
option domain-name-servers 192.168.4.99;
option routers 192.168.4.1;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.4.99; //制定下一個(gè)服務(wù)器,由于下一個(gè)服務(wù),依然在本機(jī)搭建,所以ip仍然
filename "pxelinux.0"; // 網(wǎng)卡引導(dǎo)文件(二進(jìn)制文件),用來(lái)下載內(nèi)核,驅(qū)動(dòng)文件
}
[root@pxe-server-04 ~]# service dhcpd restart
關(guān)閉 dhcpd: [確定]
正在啟動(dòng) dhcpd: [確定]
//安裝,配置tftp服務(wù)
//這里使用tftp的原因在于,在裝機(jī)到此時(shí),客戶(hù)端計(jì)算機(jī)并沒(méi)有系統(tǒng),所以就連用戶(hù)都沒(méi)有,所以需要使用這個(gè)簡(jiǎn)單文件傳輸系統(tǒng)
[root@pxe-server-04 ~]# yum -y install tftp-server
[root@pxe-server-04 ~]# service xinetd restart
停止 xinetd: [失敗]
正在啟動(dòng) xinetd: [確定]
[root@pxe-server-04 ~]# chkconfig xinetd on //臨時(shí)服務(wù)管理器
[root@pxe-server-04 ~]# chkconfig xinetd --list
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@pxe-server-04 ~]# chkconfig tftp on //開(kāi)啟臨時(shí)服務(wù)
[root@pxe-server-04 ~]# chkconfig tftp --list
tftp on
[root@pxe-server-04 ~]# cd /var/lib/tftpboot/ //進(jìn)入tftp共享目錄
[root@pxe-server-04 tftpboot]# ls
[root@pxe-server-04 tftpboot]# yum provides */pxelinux.0 //查詢(xún)?cè)撐募怯赡膫€(gè)rpm生成的
Failed to set locale, defaulting to C
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
syslinux-nonlinux-4.04-3.el6.noarch : SYSLINUX modules which aren't run from linux. //pxelinux.0 即是由該rpm包產(chǎn)生的,接下來(lái)只需要安裝該包即可
Repo : 192.168.4.254_rhel6
Matched from:
Filename : /usr/share/syslinux/pxelinux.0
[root@pxe-server-04 tftpboot]# yum -y install syslinux-nonlinux
[root@pxe-server-04 tftpboot]# rpm -ql syslinux-nonlinux | grep pxelinux.0 //查找該文件所在路徑
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/pxelinux.0
[root@pxe-server-04 tftpboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ //拷貝到tftp目錄中
[root@pxe-server-04 tftpboot]# ls
pxelinux.0
//接下來(lái)需要準(zhǔn)備裝機(jī)時(shí)的軟件包,內(nèi)核,驅(qū)動(dòng)等相關(guān)文件
//這些文件都在系統(tǒng)的ISO鏡像文件中,當(dāng)然以可以使用光驅(qū)掛載系統(tǒng)光盤(pán),但是由于服務(wù)器一般不會(huì)帶光驅(qū),所以使用文件的情況會(huì)更多一些,這里我們使用ISO鏡像文件
[root@pxe-server-04 ~]# ls rhel-server-6.7-x86_64-dvd.iso
rhel-server-6.7-x86_64-dvd.iso
[root@pxe-server-04 ~]# ls CentOS-6.7-x86_64-bin-DVD1.iso
CentOS-6.7-x86_64-bin-DVD1.iso
// 一般上述ISO鏡像文件會(huì)掛載在ftp服務(wù)器上或web服務(wù)器上,所以這里我們先搭建web,即httpd服務(wù)
[root@pxe-server-04 ~]# yum -y install httpd
[root@pxe-server-04 ~]# service httpd restart
停止 httpd: [失敗]
正在啟動(dòng) httpd:httpd: apr_sockaddr_info_get() failed for pxe-server-04.wolf.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[確定]
[root@pxe-server-04 ~]# chkconfig httpd on
[root@pxe-server-04 ~]# chkconfig httpd --list
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@pxe-server-04 ~]# vim /etc/httpd/conf/httpd.conf //httpd服務(wù)主配置文件,這里使用缺省配置即可,所以不需要修改,就是單純的亮出來(lái)
[root@pxe-server-04 ~]# cd /var/www/html/ //httpd服務(wù)缺省文件路徑,我們需要將ISO鏡像文件掛載到這里
//這里我們使用自動(dòng)掛載,當(dāng)然也可以使用手動(dòng)掛載或者觸發(fā)掛載
[root@pxe-server-04 html]# mkdir redhat-6.7
[root@pxe-server-04 html]# mkdir centos-6.7 //創(chuàng)建掛載點(diǎn)
[root@pxe-server-04 html]# vim /etc/fstab
[root@pxe-server-04 html]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Mar 29 20:53:13 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=146c8194-872b-43cf-9046-58a8d2ee2117 /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/root/rhel-server-6.7-x86_64-dvd.iso /var/www/html/redhat-6.7 iso9660 defaults,loop 0 0 //添加配置信息
/root/CentOS-6.7-x86_64-bin-DVD1.iso /var/www/html/centos-6.7 iso9660 defaults,loop 0 0 //添加配置信息
[root@pxe-server-04 html]# mount -a
[root@pxe-server-04 html]# ls redhat-6.7/ //驗(yàn)證結(jié)果
EFI EULA_en EULA_it EULA_pt HighAvailability README ResilientStorage TRANS.TBL media.repo
EULA EULA_es EULA_ja EULA_zh LoadBalancer RPM-GPG-KEY-redhat-beta ScalableFileSystem images release-notes
EULA_de EULA_fr EULA_ko GPL Packages RPM-GPG-KEY-redhat-release Server isolinux repodata
[root@pxe-server-04 html]# ls centos-6.7/ //驗(yàn)證結(jié)果
CentOS_BuildTag EULA Packages RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Security-6 TRANS.TBL isolinux
EFI GPL RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Debug-6 RPM-GPG-KEY-CentOS-Testing-6 images repodata
//現(xiàn)在ISO文件已經(jīng)掛載好了,那么接下來(lái)需要回到tftp目錄下,準(zhǔn)備相關(guān)的文件
[root@pxe-server-04 html]# cd /var/lib/tftpboot/
[root@pxe-server-04 tftpboot]# ls
pxelinux.0
[root@pxe-server-04 tftpboot]# mkdir redhat-6.7
[root@pxe-server-04 tftpboot]# mkdir centos-6.7 //由于這次我們是想將redhat和centos都集成進(jìn)來(lái),便于日后的擴(kuò)占和方便,所以需要對(duì)redhat和centos進(jìn)行區(qū)分,防止兩個(gè)系統(tǒng)的內(nèi)核文件和驅(qū)動(dòng)文件混淆導(dǎo)致錯(cuò)誤
//當(dāng)然也可以只安裝一個(gè),如果只安裝一個(gè),那么這里就不需要整個(gè)文件夾的創(chuàng)建,直接操作即可,不過(guò)建議還是建立一個(gè),便于日后的擴(kuò)展
//查看文件,
[root@pxe-server-04 tftpboot]# ls /var/www/html/redhat-6.7/isolinux/
TRANS.TBL boot.cat boot.msg grub.conf initrd.img isolinux.bin isolinux.cfg memtest splash.jpg vesamenu.c32 vmlinuz
[root@pxe-server-04 tftpboot]# ls /var/www/html/centos-6.7/isolinux/
TRANS.TBL boot.cat boot.msg grub.conf initrd.img isolinux.bin isolinux.cfg memtest splash.jpg vesamenu.c32 vmlinuz
[root@pxe-server-04 tftpboot]# cp /var/www/html/redhat-6.7/isolinux/initrd.img redhat-6.7/ //拷貝redhat的驅(qū)動(dòng)文件
[root@pxe-server-04 tftpboot]# cp /var/www/html/redhat-6.7/isolinux/vmlinuz redhat-6.7/ //拷貝redhat的內(nèi)核文件
[root@pxe-server-04 tftpboot]# cp /var/www/html/centos-6.7/isolinux/initrd.img centos-6.7/
[root@pxe-server-04 tftpboot]# cp /var/www/html/centos-6.7/isolinux/vmlinuz centos-6.7/
//由于菜單文件和圖形化文件只需要一份,所以無(wú)需區(qū)分
//創(chuàng)建菜單文件目錄,并將菜單文件拷貝,拷貝的同時(shí)改名為default
[root@pxe-server-04 tftpboot]# mkdir pxelinux.cfg //缺省配置,不能改變
[root@pxe-server-04 tftpboot]# cp /var/www/html/centos-6.7/isolinux/isolinux.cfg pxelinux.cfg/default
//拷貝圖形化支持文件
[root@pxe-server-04 tftpboot]# cp /var/www/html/centos-6.7/isolinux/vesamenu.c32 /var/lib/tftpboot/
//驗(yàn)證結(jié)果
[root@pxe-server-04 tftpboot]# pwd
/var/lib/tftpboot
[root@pxe-server-04 tftpboot]# ls
centos-6.7 pxelinux.0 pxelinux.cfg redhat-6.7 vesamenu.c32
[root@pxe-server-04 tftpboot]# ls centos-6.7/
initrd.img vmlinuz
[root@pxe-server-04 tftpboot]# ls redhat-6.7/
initrd.img vmlinuz
[root@pxe-server-04 tftpboot]# ls pxelinux.cfg/
default
//準(zhǔn)備裝機(jī)背景圖片,由于這次安裝時(shí)的菜單頁(yè)面我們是要采用圖形化頁(yè)面,所以需要一張圖片作為背景
//Linux裝機(jī)時(shí)的背景圖片是需要特殊制作的
[root@pxe-server-04 tftpboot]# rpm -ql syslinux | grep .jpg
/usr/share/doc/syslinux-4.04/sample/m16-640x640-syslinux.jpg
/usr/share/doc/syslinux-4.04/sample/syslinux_splash.jpg
[root@pxe-server-04 tftpboot]# cp /usr/share/doc/syslinux-4.04/sample/syslinux_splash.jpg pxelinux.cfg/
[root@pxe-server-04 tftpboot]# ls pxelinux.cfg/
default syslinux_splash.jpg
//修改菜單文件
[root@pxe-server-04 tftpboot]# chmod +w pxelinux.cfg/default //添加可寫(xiě)權(quán)限,當(dāng)然在root用戶(hù)下,可以強(qiáng)制修改,但是建議還是添加一下
[root@pxe-server-04 tftpboot]# ls -l pxelinux.cfg/default
-rw-r--r--. 1 root root 923 Dec 17 11:09 pxelinux.cfg/default
[root@pxe-server-04 tftpboot]# vim pxelinux.cfg/default
[root@pxe-server-04 tftpboot]# cat pxelinux.cfg/default
default vesamenu.c32 //圖形化支撐文件
#prompt 1
timeout 600 //讀秒時(shí)間,表示十分之一秒
display boot.msg
menu background pxelinux.cfg/syslinux_splash.jpg //背景圖片路徑
menu title INTALL LINUX //菜單文件標(biāo)題,可隨意
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 redhat-6.7 //選項(xiàng)標(biāo)簽
menu label Install ^RedHat6.7 //標(biāo)簽顯示內(nèi)容,"^"表示可以通過(guò)按鍵后面的第一個(gè)字母進(jìn)行快速選擇
menu default //默認(rèn),當(dāng)讀秒結(jié)束后,沒(méi)有進(jìn)行其他操作的話,會(huì)選擇該配置所在的標(biāo)簽
kernel redhat-6.7/vmlinuz //redhat的內(nèi)核文件,注意區(qū)分,也可以對(duì)vmlinuz進(jìn)行改名操作,以名詞區(qū)分,這里使用目錄進(jìn)行區(qū)分
append initrd=redhat-6.7/initrd.img
label centos-6.7
menu label Install ^CentOS6.7
kernel centos-6.7/vmlinuz
append initrd=centos-6.7/initrd.img
label rescue
menu label ^Rescue installed system //救援模式,任意選擇使用哪一個(gè)版本的驅(qū)動(dòng)和內(nèi)核,該標(biāo)簽在裝機(jī)時(shí),并無(wú)作用
kernel centos-6.7/vmlinuz
append initrd=centos-6.7/initrd.img rescue
label local //從本地硬盤(pán)啟動(dòng)
menu label Boot from ^local drive
localboot 0xffff
//準(zhǔn)備應(yīng)答文件,接下來(lái)要將在裝機(jī)時(shí)的選項(xiàng)和配置做成一個(gè)配置文件,以實(shí)現(xiàn)自動(dòng)化裝機(jī)操作
//可以直接手動(dòng)編寫(xiě),但是那樣難度較大,這里我們選擇使用一款圖像化的軟件
//截圖放在了后面,各位可以參考圖片進(jìn)行操作
[root@pxe-server-04 ~]# yum -y install system-config-kickstart
[root@pxe-server-04 ~]# system-config-kickstart //啟動(dòng)軟件
[root@pxe-server-04 ~]# cd /var/www/html/
[root@pxe-server-04 html]# ls
centos-6.7 centos6.7-ks.cfg config.sh redhat-6.7
[root@pxe-server-04 html]# cat centos6.7-ks.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.4.99/centos-6.7"
# Root password
rootpw --iscrypted $1$15OTgffs$30Fh3lNZVXIdIu1qfgBwt1
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1
%post --interpreter=/bin/bash
wget http://192.168.4.254/config.sh
chmod +x config.sh
./config.sh
%end
%packages
@base
%end
//在這里我多加了一個(gè)安裝后執(zhí)行腳本
//該功能是在系統(tǒng)裝完之后,自動(dòng)去執(zhí)行的腳本
[root@pxe-server-04 html]# ls config.sh
config.sh
[root@pxe-server-04 html]# ls redhat-config.sh
redhat-config.sh
[root@pxe-server-04 html]# cat config.sh
rm -rf /etc/yum.repos.d/*
cd /etc/yum.repos.d/
echo '
[centos-yum]
ame=added from: http://192.168.4.254/CentOS-6
baseurl=http://192.168.4.254/CentOS6
enabled=1
gpgcheck=0' > centos-yum.repo
yum clean all
yum repolist
yum -y install vsftpd
service vsftpd start
chkconfig vsftpd on
useradd test-user-01
echo 123456 | passwd --stdin test-user-01
[root@pxe-server-04 html]#
[root@pxe-server-04 html]# cp centos6.7-ks.cfg redhat6.7-ks.cfg
[root@pxe-server-04 html]# ls redhat6.7-ks.cfg
redhat6.7-ks.cfg
[root@pxe-server-04 html]# vim redhat6.7-ks.cfg //其他保持不變,將路徑修改為redhat的包路徑即可
//還有兩個(gè)系統(tǒng)的腳本文件,由于yum的原因,也進(jìn)行了區(qū)分
//url --url="http://192.168.4.99/redhat-6.7"
//%post --interpreter=/bin/bash
wget http://192.168.4.99/redhat-config.sh
chmod +x config.sh
./config.sh
%end
//將應(yīng)答文件添加進(jìn)配置文件
[root@pxe-server-04 tftpboot]# vim pxelinux.cfg/default
label redhat-6.7
menu label Install ^RedHat6.7
menu default
kernel redhat-6.7/vmlinuz
append initrd=/redhat-6.7/initrd.img ks=http://192.168.4.99/redhat6.7-ks.cfg
label centos-6.7
menu label Install ^CentOS6.7
kernel centos-6.7/vmlinuz
append initrd=centos-6.7/initrd.img ks=http://192.168.4.99/centos6.7-ks.cfg
結(jié)果驗(yàn)證
系統(tǒng)安裝流程
腳本執(zhí)行結(jié)果驗(yàn)證
[root@pc-113 ~]# ifconfig eth0 | head -2
eth0 Link encap:Ethernet HWaddr 52:54:00:0D:66:DF
inet addr:192.168.4.113 Bcast:192.168.4.255 Mask:255.255.255.0
[root@pc-113 ~]# hostname
pc-113.war.cn
[root@pc-113 ~]# service vsftpd status
vsftpd (pid 1469) 正在運(yùn)行...
[root@pc-113 ~]# grep test-user-01 /etc/passwd
test-user-01:x:500:500::/home/test-user-01:/bin/bash