您的位置:首页 > 其它

PXE推送,NFS切换本地源

2018-08-31 11:29 543 查看
yum -y install tftp-server

修改TFTP配置文件
vi /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
yum -y install dhcp
安装DHCP 修改配置文件
cat > /etc/dhcp/dhcpd.conf << EOF
allow booting;
allow bootp;
ddns-update-style interim;
ignore client-updates;
subnet 192.168.10.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.10.1;
range dynamic-bootp 192.168.10.100 192.168.10.200;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.10.1;
filename "pxelinux.0";
}
EOF
创建NFS目录

mkdir /nfs ######存放安装镜像
mkdir /config #####存放KS文件
修改NFS配置
vi /etc/exports
/nfs *(ro)
/config *(ro)
yum -y install syslinux
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
mkdir -p /var/lib/tftpboot/pxelinux.cfg
mount /dev/sr0 /nfs 挂载安装源
cp /nfs/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

vim default

default文件配置
-----------------------
default linux
timeout 60
display boot.msg
label linux
kernel vmlinuz
append initrd=initrd.img inst.stage2=nfs:192.168.10.1:/nfs ks=nfs:192.168.10.1:/config/ks.cfg quiet
menu end
ks文件可以用system-config-kickstart生成
出现不能选择安装包的问题 增加YUM源
vi /etc/yum.repos.d/development.repo
[development]
name=base
baseurl=file:///nfs
enabled=1
gpgcheck=0
挂载ISO文件 切换安装镜像 每次携带虚拟机更换镜像
#!/bin/bash
mount /dev/sr0 /nfs
/bin/cp -f /nfs/images/pxeboot/initrd.img /var/lib/tftpboot/
/bin/cp -f /nfs/images/pxeboot/vmlinuz /var/lib/tftpboot/
/bin/cp -f /nfs/isolinux/vesamenu.c32 /var/lib/tftpboot/
/bin/cp -f /nfs/isolinux/boot.msg /var/lib/tftpboot/
systemctl stop firewalld.service
systemctl start dhcpd
systemctl start xinetd.service
systemctl start nfs-server.service
ks文件
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'# Reboot after installation
reboot
# Root password
rootpw --iscrypted $1$vcJPtcO6$cENeN0IzJRuP5nPaDsfMh.
# System timezone
timezone Asia/Shanghai
# System language
lang en_US
# Firewall configuration
firewall --disabled
# System authorization information
auth --passalgo=sha512
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
# SELinux configuration
selinux --disabled

# Use NFS installation media
nfs --server=192.168.10.1 --dir=/nfs
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all

%packages
@base
@compat-libraries
@fonts
@gnome-desktop
@graphical-admin-tools
@legacy-x
@network-tools
@perl-runtime
@system-management
@x11
%end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  pxe