1.配置yum源
vim /etc/yum.repos.d/development.repo
[development]
name=yum server
baseurl=file:///mnt
enabled=1
gpgcheck=0
2.挂载光盘
mount /dev/sr0 /mnt
3.安装相关软件包
yum install dhcp syslinux xinetd tftp-server
4.配置dhcp
vim /etc/dhcp/dhcpd.conf
5.添加内容
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.91 192.168.1.120; //ip地址池
option domain-name-servers 192.168.1.1; //网管地址
option domain-name "internal.example.org";
option routers 192.168.1.1; //网关地址
option broadcast-address 192.168.1.255;
next-server 192.168.1.31; //ftp服务器地址
filename "pxelinux.0";
default-lease-time 600;
max-lease-time 7200;
}
6.启动服务和开机自启动
systemctl start dhcpd.service
systemctl enable dhcpd.service
7.复制启动文件
cd /var/lib/tftpboot/ #进入/var/lib/tftpboot/
cp /mnt/isolinux/initrd.img /var/lib/tftpboot #复制initrd.img到/var/lib/tftpboot目录下
cp /mnt/isolinux/vmlinuz /var/lib/tftpboot/ #复制vmlinuz到/var/lib/tftpboot目录下
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ #复制pxelinux.0到/var/lib/tftpboot目录下
cp /mnt/isolinux/vesamenu.c32 /var/lib/tftpboot/ #复制vesamenu.c32到/var/lib/tftpboot目录下
cp /mnt/isolinux/boot.msg /var/lib/tftpboot/ #复制boot.msg到/var/lib/tftpboot目录下
cd /var/lib/tftpboot/ #进入/var/lib/tftpboot目录下
mkdir pxelinux.cfg #在/var/lib/tftpboot目录下创建pxelinux.cfg目录
cd pxelinux.cfg/ #进入pxelinux.cfg目录下
cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default #复制isolinux.cfg到pxelinux.cfg目录下并命名为default
vim default #在/var/lib/tftpboot/pxelinux.cfg目录下修改default文件
label PXE-linux
menu label ^Install System from PXE-RHEL7.0
menu default
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.1.31/ks.cfg ksdevice=eno16777736 ip=dhcp quiet
8.配置tftp-server syslinux
vim /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
}
9.启动服务和开机自启动
systemctl start xinetd.service
systemctl enable xinetd.service
10.安装配置VSFTP
yum -y install vsftpd
cp -rf /mnt/* /var/ftp/pub/
11.启动服务
systemctl start vsftpd
systemctl enable vsftpd
12.无图形界面配置kickstart一键安装应答文件
vim /var/ftp/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'# Reboot after installation
reboot
# Root password
rootpw --iscrypted $1$FyasdJen$q2zUDfVq.ln1FmIlP8O/m0 //root密码为7788521
# System timezone
timezone Asia/Shanghai
# Use network installation
url --url="ftp://192.168.1.31/pub"
# System language
lang en_US
# Firewall configuration
firewall --disabled
# Network information
network --bootproto=dhcp --device=eno16777736
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap --asprimary --fstype="swap" --size=2048
part /boot --asprimary --fstype="xfs" --size=500
part / --asprimary --fstype="xfs" --grow --size=1
%packages
@base
%end
图形化系统可以安装Kickstart
1.安装Kickstart
yum -y install system-config-kickstart.noarch
2.启动Kickstart软件
system-config-kickstart
13.修改SELinux状态
vim /etc/sysconfig/selinux
SELINUX=disabled
14.开放防火墙服务和端口
firewall-cmd --permanent --add-service=dhcp
firewall-cmd --permanent --add-service=vsftpd
firewall-cmd --permanent --add-port=69/udp
firewall-cmd --permanent --add-port=111/tcp
firewall-cmd --permanent --add-port=111/udp
firewall-cmd --permanent --add-port=20048/tcp
firewall-cmd --permanent --add-port=20048/udp
firewall-cmd --reload