First, PXE introduction
PXE full name Pre-Boot execution environment, pre-boot execution environment, boot the computer over a network interface, independent of local storage device or locally installed operating system;client/server mode of Operation
Second, Pxe+kickstart unattended process
Three, Pxe+kickstart realize automatic installation system
1. Environment
[[email protected] ~]# cat/etc/redhat-releasecentos release 6.9 (Final) [[email protected] ~]# uname-< Span style= "COLOR: #000000" >r 2.6 . 32 -696 ~]#/etc/init.d/iptables statusiptables: Firewall is not running.[ [Email protected] ~]# getenforcedisabled[[email protected] ~]# hostname-i 10.0 . 0.61 172.16 . 1.61
2. Configure DHCP Service
Yum Install DHCP-y #安装DHCP服务cat>>/etc/dhcp/dhcpd.conf<<eofsubnet172.16.1.0Netmask255.255.255.0{Range172.16.1.120 172.16.1.200; #可分配的地址池option Subnet-mask255.255.255.0; #子网掩码default-lease-time21600; #默认IP租用期限Max-lease-time43200; #默认最大的IP租用期限Next-server172.16.1.61; #指明tftp服务器的IP地址filename"/pxelinux.0"; #告知客户端从TFTP根目录下载pxelinux. 0 file } EOF[[Email protected]~]#/etc/init.d/dhcpd startstarting dhcpd: [OK][[email protected]~]# lsof-i: #检查dhcp服务是否启动COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEDHCPD27302dhcpd7uIPv41320090t0 UDP *:bootps
3. Configuring the TFTP service
[Email protected] ~]# yum-y install tftp-'14s#yes#no#' /etc/xinetd.d/~ ]#/etc/init.d/xinetd startstarting xinetd: [ OK ~]# lsof-i:COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE namexinetd 27339 root 5u 132413 0t0 UDP *:tftp
4. Configuring the HTTP Service
[email protected] ~]# Yum-y install httpdsed-I."277i ServerName 127.0.0.1:80"/etc/httpd/conf/httpd.conf #去掉提示信息[[email protected]~]#/etc/init.d/httpd startstarting httpd: [OK][[email protected]~]# mkdir-p/var/www/html/centos6.9 #创建镜像目录[Roo[email protected]~]# Mount/dev/cdrom/var/www/html/centos6.9 #挂载光盘到镜像目录Mount:block Device/dev/sr0 iswrite-protected, mounting read-Only[[email protected]~]# DF-hfilesystem Size used Avail use%mounted on/dev/sda36.9G1.8G4.8G -% /Tmpfs 242M0242M0%/dev/SHM/DEV/SDA1 190M 34M 146M +% /Boot/dev/sr03.7G3.7G0 -% /var/www/html/centos6.9
5. Configure the files required for PXE boot
Yum-y install syslinux #为了使用pxelinux. 0 while installing the package CP/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/#复制pxe启动文件CP-A/var/www/html/centos6.9/isolinux/*/var/lib/tftpboot/#从镜像中复制相关文件Mkdir-p/var/lib/tftpboot/pxelinux.cfgcp/var/www/html/centos6.9/isolinux/isolinux.cfg/var/lib/tftpboot/ Pxelinux.cfg/default[[email protected] tftpboot]# ll/var/lib/tftpboot/total 45356-r--r--r--1 root root 2048 Mar 29 boot.cat-r--r--r--1 root root boot.msg-r--r--r--1 root root 321 mar grub.conf-r --r--r--1 root root 41587792 Mar initrd.img-r--r--r--1 root root 24576 mar isolinux.bin-r--r--r--1 Root root 923 Mar isolinux.cfg#修改此文件可以定制安装系统界面-r--r--r--1 root root 183012 Mar memtest-rw-r--r--1 root root 26759 Oct one 05:56 pxelinux.0drwxr-xr-x 2 ro OT root 4096 Oct 05:56 pxelinux.cfg-r--r--r--1 root root 151230 Mar splash.jpg-r--r--r--1 root root 2215 Mar TRANS. tbl-r--r--r--1 root root 163728 Mar vesamenu.c32-r-xr-xr-x 1 root root 4274992 mar Vmlinuz
Open Browser input at this time
6. Configuring the Ks.cfg File
[Email protected] ks_config]# mkdir/var/www/html/ks_config/-p
[Email protected] ks_config]# grub-crypt #设置加密密码
Password:
Retype Password:
$6$3su6kwgqsbirvqre$w8l3tll51saewzxyobdb8axit468hmj0hwmqxqax1ozqkn3rxhrb7hvp6bewtfrlqljqcmtvvagje5dqvnnxz.
[email protected] ks_config]# VI/var/www/html/ks_config/centos-6.9-ks.cfg# Kickstart Configurator forCentos6.9 by Yan XinjiangInstallURL--url="http://172.16.1.61/CentOS6.9/"Textlang en_US. UTF-8keyboard Uszerombrbootloader--LOCATION=MBR--DRIVEORDER=SDA--append="Crashkernel=auto RHGB Quiet"Network--bootproto=dhcp--device=eth1--onboot=yes--noipv6--hostname=Centos6timezone--UTC asia/Shanghaiauthconfig--enableshadow--passalgo=SHA512ROOTPW--iscrypted $6$X 20ertuzhkhzntb4$dk0bjbyosawsdd8jcclvfz0cscijs9ldmwwpocw/Zejyw2btqygwlgksn945fftjrc658uxjuocwjbajvi5d6/Clearpart--all--Initlabel[[email protected] ks_config]# cat/var/www/html/ks_config/centos-6.9-ks.cfg# Kickstart Configurator forCentos6.7by Yao Zhanginstallurl--url="http://172.16.1.61/CentOS6.9/"Textlang en_US. UTF-8keyboard Uszerombrbootloader--LOCATION=MBR--DRIVEORDER=SDA--append="Crashkernel=auto RHGB Quiet"Network--bootproto=dhcp--device=eth1--onboot=yes--noipv6--hostname=Centos6timezone--UTC asia/Shanghaiauthconfig--enableshadow--passalgo=SHA512ROOTPW--iscrypted $6$X 20ertuzhkhzntb4$dk0bjbyosawsdd8jcclvfz0cscijs9ldmwwpocw/zejyw2btqygwlgksn945fftjrc658uxjuocwjbajvi5d6/Clearpart--all--Initlabelpart/boot--FSTYPE=EXT4--asprimary--size= $Part Swap--size=1024x768 Part/--FSTYPE=EXT4--grow--asprimary--size= $Firstboot--Disableselinux--Disabledfirewall--disabledlogging--level=Inforeboot%packages #选择安装系统需要的一些库和安装包@base @compat-libraries@debugging@developmenttreenmapsysstatlrzszdos2unixtelnet%Post #可以安装执行的脚本, you can put your own optimization in which wget-o/tmp/optimization.sh http://172.16.1.61/ks_config/optimization.sh &>/dev/null/bin/sh/tmp/optimization.sh%end
7. Configure the default file
[[email protected] ks_config]# CAT/var/lib/tftpboot/pxelinux.cfg/defaultdefault 0label ks kernel vmlinuz append initrd=initrd.img ks=http:// 172.16.1.61/ks_config/centos-6.9-ks.cfg ksdevice=eth1
8. Complete unattended automatic installation system
Power on the system, drink a little tea, the last toilet back system is OK
Linux operation and Architecture-kickstart unattended