安装部署
yum install dhcp tftp-server httpd syslinux -y
vim /etc/xinetd.d/tftpdisable=no #将yes改为no
netstat -antlupe |grep 69
tcp6 0 0 :::40071 :::* LISTEN 29 23969 1300/rpc.statd
udp 0 0 0.0.0.0:69 0.0.0.0:* 0 29925 1788/xinetd
[[email protected] ~]# cd /var/lib/tftpboot/
[[email protected] tftpboot]# cp /usr/share/syslinux/pxelinux.0 .
mkdir pxelinux.cfg
scp 172.25.254.150:/var/www/html/rhel7.2/isolinux/* . #从主机挂载镜像处获取镜像文件
cp isolinux.cfg pxelinux.cfg/default
[[email protected] tftpboot]# ls
boot.cat initrd.img memtest splash.png vesamenu.c32
boot.msg isolinux.bin pxelinux.0 TRANS.TBL vmlinuz
grub.conf isolinux.cfg pxelinux.cfg upgrade.img
[[email protected] tftpboot]# cp isolinux.cfg pxelinux.cfg/default
[[email protected] tftpboot]# ls
boot.cat initrd.img memtest splash.png vesamenu.c32
boot.msg isolinux.bin pxelinux.0 TRANS.TBL vmlinuz
grub.conf isolinux.cfg pxelinux.cfg upgrade.img
配置dhcp使安装时可以获取ip
[[email protected] tftpboot]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? yes
[[email protected] tftpboot]# vim /etc/dhcp/dhcpd.conf
option domain-name "westos.com";
option domain-name-servers 172.25.254.50;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 172.25.254.0 netmask 255.255.255.0 {
range 172.25.254.110 172.25.254.120;
option routers 172.25.254.50;
next-server 172.25.254.133;
filename "pxelinux.0";
}
修该默认安装文件
vim pxelinux.cfg/default
2 #timeout 6003 timeout 60 #默认停留时间
12 #menu title Red Hat Enterprise Linux 7.0
13 menu title welcome to westos #默认安装界面标题
64 menu label ^Install Red Hat Enterprise Linux 7.0
65 menu default #安装默认进入界面
66 kernel vmlinuz
67 append initrd=initrd.img repo=http://172.25.254.50/rhel7.2 #指定镜像挂载位置
[[email protected] tftpboot]# systemctl start dhcpd
[[email protected] tftpboot]# systemctl restart xinetd.service
设置从网卡启动
制作背景照片,要设置i的照片必需和原图片同像素同类型
convert -resize 640x480! 1.png westos.png #将图片裁剪并重命名
测试:
制作ks.cfg
yum install system-config-kickstart -y #下载kickstart制作软件
system-config-kickstart #进入制作界面
编辑ks.cfg文件加入安装时执行的动作
[[email protected] html]# vim ks2.cfg
@base
lftp
%end
%post
cat >> /etc/yum.repos.d/yum.repo <<EOF #配置yum源
[rhel7]
name=rhel7
baseurl=http://172.25.254.50/rhel7
gpgcheck=0
EOF
rm -fr /etc/sysconfig/network-scripts/ifcfg-eth0
cat >>/etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF #设置指定ip
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.127
PREFIX=24
EOF
systemctl restart network
yum install httpd -y #安装软件
systemctl start httpd
systemctl enable httpd
systemctl stop firewalld
echo 172.25.254.127> /var/www/html/index.html
%end
[[email protected] html]# ksvalidator ks2.cfg #检验ks文件是否有错误
67 append initrd=initrd.img repo=http://172.25.254.50/rhel7.2 ks=http://172.25.254.133/ks2.cfg #指定ks文件位置
安装阶段:
进入安装界面
磁盘分区中
进入安装程序包阶段
安装后测试:
查看yum源配置
查看ip