使用PXE+kickstart部署无人值守安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用PXE+kickstart部署无人值守安装相关的知识,希望对你有一定的参考价值。
实验是在虚拟机上实现,在真实的生产环境下的无人值守安装,需要根据具体情况自行进行调整。
实验前,已经预装了一台CentOS6.5 32位的虚拟机,使用的是NAT模式,IP地址为192.168.206.131,网关是192.168.206.2。
我们要在无人值守安装服务端实现如下配置:
tftp服务器:192.168.206.131
nfs服务器:192.168.206.131
dhcp服务器:192.168.206.131
先将软件进行安装:
yum install -y tftp tftp-server xinetd dhcp syslinux nfs-utils rpcbind
1.配置tftp:
vim /etc/xinetd.d/tftp // 内容如下:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no // 只需要更改蓝色字体的这一部分
per_source = 11
cps = 100 2
flags = IPv4
}
修改完后要启动tftpd服务
service xinetd start
2.配置dhcp
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf 复制如下的内容
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";
}
启动dhcp服务: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 // 内容为:
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 // 内容如下:
#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.无人值守安装
新建一个虚拟机,设置为nat模式,开启后,开始自动安装。
本文出自 “94包子” 博客,请务必保留此出处http://cct0513.blog.51cto.com/12331798/1896955
以上是关于使用PXE+kickstart部署无人值守安装的主要内容,如果未能解决你的问题,请参考以下文章
linux系统服务-PXE批量部署kickstart无人值守