PXE高效批量网络装机
-
将光盘挂载到/var/ftp/centos7/
[root@wangluoyuan ~]# mount /dev/sr0 /var/ftp/centos7/
-
查看内存
Df-hT
3.检查yum仓库
[root@wangluoyuan ~]# yum clean all
[root@wangluoyuan ~]# yum repolist
4.编辑centos-Base…repo
[root@wangluoyuan ~]# vim /etc/yum.repos.d/CentOS-Base.repo
5.下载tftp-server
[root@wangluoyuan ~]# yum install -y tftp-server
编辑/etc/xinetd.d/tftp
[root@wangluoyuan ~]# vim /etc/xinetd.d/tftp
6.开启tftp复制 并设置开机自启动
[root@wangluoyuan ~]# systemctl enable tftp –now
7.检测是否开启
8.进入/var/ftp/centos7/images/pxeboot/将initrd.img vmlinuz两个文件复制到/tftpboot
[root@wangluoyuan ~]# cd /var/ftp/centos7/images/pxeboot/
[root@wangluoyuan pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot
9.下载软件syslinux获取该软件里面的一个文件(/usr/share/syslinux/pxelinux.0)并复制到/var/lib/tftpboot
[root@wangluoyuan tftpboot]# cp /usr/share/syslinux/pxelinux.0 ./
10.进入新建文件夹pxelinux.cfg 创建文件default并编辑
11.编辑dhcp配置文件并重启
[root@wangluoyuan pxelinux.cfg]# vim /etc/dhcp/dhcpd.conf
[root@wangluoyuan pxelinux.cfg]# systemctl restart dhcpd
11.开启dhcpd,vsftp,named并关闭防火墙
二.新建一台图形化Linux系统(注意:一定需要一台有图形化的系统)
1.下载system-config-kickstart syslinux
[root@localhost roo]# yum install -y system-config-kickstart syslinux
3. 进入自己本地yum源仓库文件cd /etc/yum.repos.d移动所有*.repo文件到back(新建文件夹中)而后将centos-cr.repo移动到yum.repos.d里。
-
编辑文件centos-cr.repo
[root@localhost yum.repos.d]# vi CentOS-CR.repo
-
清理缓存
Yum clean all -
重新加载
Yum repolist
7.system-config-kicstart (启动无人守职需要的程序软件)
8;依次配置
9:
10:
11:
必须添加三个分区: swap /boot /
Swap:
/boot:
/:
12:保存文件:
保存文件到/root目录下
13.将ks文件发送到192.168.148.129/var/ftp文件夹
[root@localhost ~]# scp ks.cfg root@192.168.148.129:/var/ftp
14.进入/var/lib/tftpboot文件夹编辑文件pxelinux.cfg
[root@wangluoyuan ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
15.重启
[root@wangluoyuan pxelinux.cfg]# systemctl restart tftp
16.新打开一台虚拟机进行验证