~]# yum install dhcpd
~]# vi /etc/dhcp/dhcpd.conf
subnet 192.168.168.0 netmask 255.255.255.0 {
option routers 192.168.168.100;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.168.128 192.168.168.254;
default-lease-time 600;
max-lease-time 7200;
#指定网络引导文件名
filename "pxelinux.0";
#指定tftp服务器地址
next-server 192.168.168.100;
}
~]# systemctl start dhcpd
~]# systemctl status dhcpd
~]# yum install tftp-server
~]# yum install xinetd
~]# vi /etc/xinetd.d/tftp
service tftp
{
socket_type =dgram
protocol =udp
wait =yes
user =root
server =/usr/sbin/in/tftpd
server_args =-s /Data/tftpboot
disable =no
per_source =11
cps =100 2
flags =IPv4
}
#-s chroot
#-c creat files
#disable 服务是否关闭
~]# systemctl start xinetd
~]# ss -upl | grep tftp
~]# yum install vsftpd
~]# vi /etc/vsftpd/vsftpd.conf
#修改匿名用户目录
anon_root=/Data/ftp
#取消匿名用户密码输入提示
no_anon_password=YES
~]# systemctl start vsftpd
~]# systemctl status vsftpd
#version=CentOS7
#version=DEVEL
# Firewall configuration
firewall --enabled --http --ssh --port=22:tcp
# Install OS instead of upgrade
install
# Use FTP installation media
#原本值为cdrom;指为光盘源安装,现修改成ftp源
ulr --url ftp://192.168.168.100/pub/CentOS7
# Root password
rootpw --iscrypted $6$.3Wlqa30zo2IeR7J$YUizzv8mrb.KDrjs0m.281rIReMZjIc3LJSrzN7l3aLcil8YUVuqaWvc.DJAr6xcLHZb.zPb8QS7mAuPCnrRT0
# System authorization information
auth --useshadow --passalgo=sha512
#Run teh Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# System keyboard
keyboard --vckeymap=us --xlayouts=‘us‘
# System language
lang en_US.UTF-8
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
#按需求定义磁盘分区
part swap --fstype="swap" -ondisk=sda --size=3000
part /boot --fstype="ext4" -ondisk=sda --size=500
part /home --fstype="ext4" -ondisk=sda --size=2000
part / --fstype="ext4" -ondisk=sda --size=5000
part /Data --fstype="ext4" -ondisk=sda --size=9900
#安装前执行命令
%pre
echo "Welcome to my kickstart"
%end
#安装后执行命令
%post --nochroot
echo "192.168.10.55 server " >> /etc/hosts
%end
#选定安装包
%packages
@compat-libraries
@core
@development
%end
~]# ksvalidator ks.cfg
~]# cp /root/ks.cfg /Data/ftp/pub/CentOS7
~]# mount /dev/cdrom /media
~]# cp -r /media/isolinux /Data/tftp
~]# mount /dev/cdrom /media
~]# cd /Data
~]# rpm2cpio /media/Packages/syslinux-4.05-8.el7.x86_64.rpm | cpio -idmv
~]# mkdir -pv /Data/tftp/pxelinux.cfg
~]# cp /Data/usr/share/syslinux/pxelinux.0 /Data/tftp/pxelinux.cfg/pxelinux.0
~]# vi /Data/tftp/pxelinux.cfg/default
default autoinstall prompt 1 timeout 10
label autoinstall
kernel vmlinuz
append ks=ftp://192.168.168.100/pub/ks.cfg initrd=initrd.img
~]# cp -r /media /Data/ftp/pub/CentOS7
/Data/tftp
/Data/tftp/pxelinux.cfg
/data/ftp/pub/CentOS7
配置文件
/etc/dhcpd/dhcpd.conf
/etc/xinetd.d/tftp
/etc/vsftpd/vsftpd.conf
/Data/ftp/pub/CentOS7/ks.cfg
/Data/tftp/pxelinux.cfg/default
原文地址:http://blog.51cto.com/linxy/2121674