PXE unattended automated installation
lab environment
dhcp server:Cerntos7 192.168.10.121
tftp server:Centos7 192.168.10.121
vsftp server: Centso7 192.168.10.122
Note: firewall, selinux are closed, yum source is a local disc image
PXE
- PXE: preboot execute environment (Pre-boot Environment), developed by Intel network boot technology, working on C / S architecture, network-based boot the client operating system installation. It allows the client to download the boot image from the remote server via a network, and load the entire file or install the entire operating system.
- Dependence dhcp, tftp, file server (vsftpd, httpd, nfs, etc.), the client host adapters, also need support BOOTROOM chip, supports PXE related agreements.
- dhcp assigned IP address and the boot file location specified.
- tftp provide guidance downloaded image file
- vsftpd download the operating system installation package, copy the contents of the disc in to the file server
- Network boot Linux related software provided by syslinux, syslinux need to install the program, list of related documents syslinux program: / usr / share / syslinux
TFTP Service
- Trivial File Transfer Protocol (Trivial File Transfer Protocol) network file based on a simple UDP transport protocol, port UDP 69
Belonging to the C / S architecture: client tftp, server program tftp-server, based daemon xinetd to run.
- xinetd configuration file: /etc/xinetd.d/tftp
tftp server provides the client file to access the root directory: / var / lib / tftpboot
PXE installation workflow automation
- After the client boots broadcasts FIND frame of dhcp
- dhcp server receives the IP address assignment frame is enough, and returns the address of the TFTP server
- Client gets pxe boot files via tftp service, and will load the kernel image file to initialize memory to run
- Get auto-answer file by default start menu location specified in the file ks.cfg initiates a request to a server tftp
- tftp server automatically returns to its answer file ks.cfg
- Obtaining position by the automatic response system image file, according to automate the installation and configuration files
other
- pxelinux.0: pxe boot program (provided by the program syslinux)
- When the system starts the boot menu, point out to load the kernel image and inird mirror, and then guide: pxelinux.cfg / default.
- vmlinuz: Linux kernel
- initrd.img: Initialization image files, stored for some drivers during boot
Set up practice
Set up a TFTP service
First, install the daemon xinetd (tftp services offer)
Installation tftp service
Modify the configuration file tftp
service tftp { socket_type = dgram protocol = udp wait = no #不等待 user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot #默认共享文件目录 disable = no #是否不可以,no表示启用tftp per_source = 11 cps = 100 2 flags = IPv4 }
Start Service
The required configuration files are placed tftp server shared directory
Where the kernel, image initialization, the boot menu
Install syslinux, and copy it came with pxe boot files to the shared directory
Cfg modify the boot menu file
default linux #默认使用linux选项 prompt 0 #是否提示 0不提示(不等待用户选择直接使用默认项) 1提示 timeout 15 #延时 label linux menu label ^Install CentOS 7 kernel vmlinuz append initrd=initrd.img inst.ks=ftp://192.168.10.122/ks.cfg quiet #附加参数,initrd指定初始化镜像文件位置,inst.ks指定kickstart自动应答文件位置
Note: default Specifies the default startup items, it should be set to the installation key
Use the directory tree view structure
Configuring DHCP Service Installation
install service
Modify the configuration file
subnet 192.168.10.0 netmask 255.255.255.0 { range 192.168.10.10 192.168.10.60; option domain-name-servers 114.114.114.114; option domain-name "www.lg.com"; option routers 192.168.10.2; default-lease-time 600; max-lease-time 7200; next-server 192.168.10.121 #TFTP服务器ip地址 filename "pxelinux.0"; #pxe引导文件名 }
Start Service
Client Test
Installation configuration VSFTP Service
install service
Installation kickstart (for graphical production of auto-answer file, requires a graphical interface)
Start system-config-kickstart answer file to automatically generate graphical
Set the default language, keyboard layout, time zone, root password, cpu architecture type, whether to restart after installation, whether text installation
Specifies the installation for the new installation, specify the location of the system image file
Specify the type of installation guide and other options
Set partition configuration
Add / boot partition
Adding swap swap partition, swap do not need to choose a mount point
Add / root partition
After completion of the partition view the partition configuration
Network configuration, specify when the need for additional network card configuration
Password encryption to verify the configuration
Firewall, SELinux configuration
Display Configuration
Select the packages to install, the name of the configuration file if the yum repository is not development will be the following errors
Solution:
Kickstart need to restart the program after modification
Pre-installation configuration script execution
After the installation is complete script execution configuration
After the setup is complete, save the configuration file to the specified directory
Placing vsftp shared directory files / var / ftp / under can
Note: Use ksvalidator order to detect whether the auto-answer file syntax errorMount the file system image to a shared directory under the ftp
Start Service
test
Create a test virtual machine
Power Test