说实话这篇文章还没写完,Kickstart还没写,因为我总是报错有机会再继续写.感谢观看
环境准备 操作系统:CentOS 7
实验平台:VMware Workstation 16 (不要求相同)
网络模式:NAT模式
服务器IP地址:192.168.100.10
防火墙:关闭
SElinux=Disable
安转DHCP服务
[root@server ~]# yum install dhcp -y[root@server ~]# vim /etc/dhcp/dhcpd.conf //修改配置文件# DHCP Server Configuration file.# see /usr/share/doc/dhcp*/dhcpd.conf.example# see dhcpd.conf(5) man page#option domain-name-servers 192.168.100.10;default-lease-time 600; //默认的Ip租期时间max-lease-time 7200; //最大的IP租期时间subnet 192.168.100.0 netmask 255.255.255.0 { range dynamic-bootp 192.168.100.21 192.168.100.30; filename "pxelinux.0"; //指定传输至客户端的启动文件名称 next-server 192.168.100.10; //指定tftp server 的Ip地址}[root@server ~]# systemctl enable --now dhcpd
安装SElinux
安装syslinux只是为了要 pxelinux.0 引导加载程序
[root@server ~]# yum install syslinux -y[root@server ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
关闭SElinux 和防火墙
[root@server ~]# setenforce 0[root@server ~]# systemctl disable --now firewalldRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
安装TFP、Xinetd、vsftp服务
[root@server ~]# yum install xinetd tftp-server vsftpd -y[root@server ~]# vim /etc/xinetd.d/tftp# default: off# description: The tftp server serves files using the trivial file transfer # protocol、 The tftp protocol is often used to boot diskless # workstations, download configuration files to network-aware printers, # and to start the installation process for some operating systems.service tftp{ socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no //将这里默认的Yes改为no per_source = 11 cps = 100 2 flags = IPv4}//因为 tftp 服务是挂载在超级进程 xinetd 下的,所以通过启动 xinetd 来启动 tftp 服务。[root@server ~]# systemctl enable --now xinetd
挂载光盘
[root@gjx ~]# mkdir /mnt/c7[root@gjx ~]# mount /dev/cdrom /mnt/c7mount: /dev/sr0 is write-protected, mounting read-only[root@gjx ~]# df -Th //查看是否挂载成功Filesystem Type Size Used Avail Use% Mounted ondevtmpfs devtmpfs 1.9G 0 1.9G 0% /devtmpfs tmpfs 1.9G 0 1.9G 0% /dev/shmtmpfs tmpfs 1.9G 21M 1.9G 2% /runtmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup/dev/mapper/centos-root xfs 36G 4.3G 31G 13% //dev/sda1 xfs 1014M 185M 830M 19% /boottmpfs tmpfs 378M 48K 378M 1% /run/user/0/dev/sr0 iso9660 4.4G 4.4G 0 100% /mnt/c7
实现PXE网络引导
复制PXE客户端启动的一些必要文件
[root@server ~]# mkdir /var/lib/tftpboot/centos7[root@server ~]# cd /var/ftp/c7[root@server c7]# lsCentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7EFI images Packages RPM-GPG-KEY-CentOS-Testing-7EULA isolinux repodata TRANS.TBL[root@server c7]# cp images/pxeboot/vmlinuz /var/lib/tftpboot/centos7/[root@server c7]# cp images/pxeboot/initrd.img /var/lib/tftpboot/centos7/[root@server ~]# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
这里采用的是ftp的方式当然也可以使用其他的方式
配置 PXE 客户端引导文件的启动信息
[root@server ~]# mkdir /var/lib/tftpboot/pxelinux.cfg[root@server ~]# vim /var/lib/tftpboot/pxelinux.cfg/defaulttimeout 100default menu.c32menu title ########## PXE Boot Menu X ##########label 1 menu label ^1) Install CentOS 7 kernel centos7/vmlinuz append initrd=centos7/initrd.img method=ftp://192.168.100.10/c7 devfs=nomountlabel 2 menu label ^2) Boot from local drive localboot~[root@server ~]# systemctl enable --now vsftpdCreated symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
测试时新建虚拟机这里我们先不安装操作系统
创建后打开我们就能看到安装成功了。