标签:
环境准备:
一台服务器
[root@admin tftpboot]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@admin tftpboot]# uname -a Linux admin 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [root@admin tftpboot]#
pxe+kickstart自动装机原理:
PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行,由这个启动软件包完成终端(客户?)基本软件设置,从而引导预先安装在服务器中的终端操作系统。PXE可以引导多种操作系统,如:Windows95/98/2000/windows2003/windows2008/winXP/win7/win8,linux等。
原理图
准备条件:
一个镜像文件
httpd服务
tftp服务
dhcp服务
[root@admin tftpboot]# mount /dev/cdrom /mnt/ [root@admin tftpboot]# yum install httpd dhcp tftp-server createrepo xinetd -y [root@admin tftpboot]# mkdir /var/www/html/CentOS-7.1-x86_64/ [root@admin tftpboot]# cp -a /mnt/* /var/www/html/CentOS-7.1-x86_64/ [root@admin tftpboot]# createrepo -pdo /var/www/html/CentOS-7.1-x86_64/ /var/www/html/CentOS-7.1-x86_64/ [root@admin tftpboot]# createrepo -g `ls /var/www/html/CentOS-7.1-x86_64/*-comps.xml` /var/www/html/CentOS-7.1-x86_64/ [root@admin tftpboot]# vim /etc/xinetd.d/tftp disable = no [root@admin dhcp-4.2.5]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf subnet 192.168.220.0 netmask 255.255.255.0 { range dynamic-bootp 192.168.220.10 192.168.220.90; option subnet-mask 255.255.255.0; next-server 192.168.220.165; filename "pxelinux.0"; } [root@admin dhcp-4.2.5]# service dhcpd start Redirecting to /bin/systemctl start dhcpd.service [root@admin dhcp-4.2.5]# service httpd start Redirecting to /bin/systemctl start httpd.service [root@admin dhcp-4.2.5]# service xinetd start Redirecting to /bin/systemctl start xinetd.service [root@admin dhcp-4.2.5]# 上传ks.cfg文件至/var/www/html/CentOS-7.1-x86_64/ [root@admin dhcp-4.2.5]# yum install syslinux -y [root@admin dhcp-4.2.5]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ [root@admin dhcp-4.2.5]# cp /mnt/isolinux/* /var/lib/tftpboot/ [root@admin tftpboot]# mkdir /var/lib/tftpboot/pxelinux.cfg [root@admin tftpboot]# cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default [root@admin pxelinux.cfg]# vim default label linux menu label ^AUTO Install CentOS 7 kernel vmlinuz append initrd=initrd.img ks=http://192.168.220.165/CentOS-7.1-x86_64/CentOS-7.1-x86_64.cfg [root@admin pxelinux.cfg]# getenforce Permissive [root@admin pxelinux.cfg]# setenforce 0 [root@admin pxelinux.cfg]# vim /etc/selinux/config SELINUX=disabled [root@admin pxelinux.cfg]# service firewalld stop Redirecting to /bin/systemctl stop firewalld.service [root@admin pxelinux.cfg]#
标签:
原文地址:http://www.cnblogs.com/along1226/p/5307614.html