實(shí)驗(yàn)是在虛擬機(jī)上實(shí)現(xiàn),在真實(shí)的生產(chǎn)環(huán)境下的無(wú)人值守安裝,需要根據(jù)具體情況自行進(jìn)行調(diào)整。
實(shí)驗(yàn)前,已經(jīng)預(yù)裝了一臺(tái)CentOS 6.5 32位的虛擬機(jī),使用的是NAT模式,IP地址為192.168.206.131,網(wǎng)關(guān)是192.168.206.2。
我們要在無(wú)人值守安裝服務(wù)端實(shí)現(xiàn)如下配置:
tftp服務(wù)器:192.168.206.131
nfs服務(wù)器:192.168.206.131
dhcp服務(wù)器:192.168.206.131
先將軟件進(jìn)行安裝:
yum install -y tftp tftp-server xinetd dhcp syslinux nfs-utils rpcbind
1.配置tftp:
vim /etc/xinetd.d/tftp // 內(nèi)容如下:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no // 只需要更改藍(lán)色字體的這一部分
per_source = 11
cps = 100 2
flags = IPv4
}
修改完后要啟動(dòng)tftpd服務(wù)
service xinetd start
2.配置dhcp
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf 復(fù)制如下的內(nèi)容
ddns-update-style interim;
ignore client-updates;
subnet 192.168.206.0 netmask 255.255.255.0 {
allow booting;
allow bootp;
allow unknown-clients;
option routers 192.168.206.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.206.2;
option time-offset -18000; # Eastern Standard Time
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# # -- you understand Netbios very well
# # option netbios-node-type 2;
range dynamic-bootp 192.168.206.100 192.168.206.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.206.131;
filename "pxelinux.0";
}
啟動(dòng)dhcp服務(wù):service dhcpd start
3.配置支持PXE
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
mkdir /install
mount /dev/cdrom /install
cd /install/images/pxeboot/
cp initrd.img vmlinuz /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg
vim /tftpboot/pxelinux.cfg/default // 內(nèi)容為:
default linux
prompt 1
timeout 30
label linux
kernel vmlinuz
append initrd=initrd.img ks=nfs:192.168.206.131:/install2/ks.cfg
保存退出
4. 配置 ks.cfg
mkdir /install2
vim /install2/ks.cfg // 內(nèi)容如下:
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.206.131 --dir=/install
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw --iscrypted $1$BYSimLw0$I515yLiKzudlwkIskBqQE1
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
#xconfig --defaultdesktop=GNOME --depth=32 --resolution=800x600
reboot
text
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=256
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages --ignoremissing
@editors
@graphics
@x-software-development
@development-libs
@development-tools
kernel-devel
e2fsprogs
kernel
5. 配置NFS
vim /etc/exports 寫入:
/install * (ro,no_root_squash,sync)
/install2 *(ro,no_root_squash,sync)
保存退出
service rpcbind start
service nfs start
6.無(wú)人值守安裝
新建一個(gè)虛擬機(jī),設(shè)置為nat模式,開(kāi)啟后,開(kāi)始自動(dòng)安裝。
PXE+Kickstart實(shí)現(xiàn)無(wú)人值守批量安裝Linux http://www.linuxidc.com/Linux/2015-11/125040.htm
Linux 基礎(chǔ)教程:Linux Kickstart 自動(dòng)安裝 http://www.linuxidc.com/Linux/2015-05/117877.htm
使用PXE+DHCP+Apache+Kickstart無(wú)人值守安裝CentOS5.8 x86_64 http://www.linuxidc.com/Linux/2012-12/76913p4.htm
Linux PXE無(wú)人值守安裝出現(xiàn) PXE-E32:TFTP OPen timeout的解決辦法 http://www.linuxidc.com/Linux/2014-03/98986.htm
使用PXE結(jié)合kickstart 自動(dòng)安裝Linux系統(tǒng) http://www.linuxidc.com/Linux/2014-03/98014.htm
Linux運(yùn)維自動(dòng)化工具 Kickstart http://www.linuxidc.com/Linux/2016-04/129978.htm
RHCE認(rèn)證之無(wú)人值守安裝Linux系統(tǒng)(FTP+TFTP+DHCP+Kickstart+PXE) http://www.linuxidc.com/Linux/2013-10/91013.htm
CentOS Kickstart及引導(dǎo)鏡像文件制作 http://www.linuxidc.com/Linux/2017-05/143714.htm
Kickstart 全自動(dòng)安裝部署RHEL 7.0 http://www.linuxidc.com/Linux/2015-09/123312.htm
本文永久更新鏈接地址:http://www.linuxidc.com/Linux/2017-03/141895.htm
聯(lián)系客服