PXE unattended Install Linux
Brief introduction: I use the combination tool used by Dhcp+tftp+ftp+kickstat
Yum-y Install xinetd dhcpd tftpdtftp-server syslinux System-config-kickstart
# Run the System-config-kickstart command and save the ks.cfg file
Vim/etc/dhcp/dhcpd.conf
Subnet 192.168.8.0 netmask 255.255.255.0 {
Option routers 192.168.8.101;
Range 192.168.8.103 192.168.8.200;
Option Domain-name-servers 192.168.8.101;
FileName "pxelinux.0";
Next-server 192.168.8.101;
Default-lease-time 600;
Max-lease-time 7200;
}
# re -DHCPD after the change
# Command Explanation
# option routers DHCP routing address
# Range DHCP allocates address pool
# default-lease-time DHCP default duration
# filename PXE service name
# Next-server PXE server address
# Allow members PXE Max
Vim/etc/xinetd.d/tftp
Disable = no
# change Disable to No and then restart daemon
Service xinetd Restart
Mount-t iso9660/dev/sr0/mnt
# 1. pxelinux.0, VESAMENU.C32 is placed in the TFTP root directory /var/lib/tftpboot/ This directory is the default
CP/USR/SHARE/SYSLINUX/{PXELINUX.0,VESAMENU.C32}/var/lib/tftpboot/
# 2. Create the pxelinux.cfg directory where the default file is ready to be stored
Mkdir/var/lib/tftpboot/pxelinux.cfg
# 3. Create a system directory to install CentOS, copy initrd.imgvmlinuz to this directory
Mkdir/var/lib/tftpboot/centos
cp/mnt/images/pxeboot/{initrd.img,vmlinuz}/var/lib/tftpboot/
Cp/mnt/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default
CP ks.cfg/var/www/html/
Vim/var/lib/tftpboot/pxelinux.cfg/default
Default Vesamenu.c32
#prompt 1
Timeout 600
Display Boot.msg
Menu Background Splash.jpg
Menu title Welcome to CentOS 6.8!
Menu Color Border 0 #ffffffff #00000000
Menu Color SEL 7 #ffffffff #ff000000
Menu Color Title 0 #ffffffff #00000000
Menu Color tabmsg 0 #ffffffff #00000000
Menu Color Unsel 0 #ffffffff #00000000
Menu Color Hotsel 0 #ff000000 #ffffffff
Menu Color Hotkey 7 #ffffffff #ff000000
Menu Color ScrollBar 0 #ffffffff #00000000
Label Linux Centos 6.8
Menu Label ^install Centos 6.8 System
Menu Defaule
Kernel Vmlinuz
Append initrd=initrd.img ks=ftp://192.168.8.101/ks.cfg
# Restart Service
Service xinetd Restart
Service DHCPD Restart
# FTP files do not need to be modified
# using the command System-config-kickstart
# Copy the command-generated file ks.cfg to the FTP directory
Cp/mnt/var/ftp/cdrom # Place the entire CD package in the FTP directory
chmod 744 ks.cfg
# ks.cfg files are as follows
#platform =x86, AMD64, or Intel EM64T
#version =devel
# Firewall Configuration
Firewall--disabled
# Install OS instead of upgrade
Install
# Use Network Installation
Url--url= "Ftp://ftpIP address/cdrom"
# Root Password
ROOTPW--iscrypted$1$jfkzkcm5$9azseedwkn2fxd5ppw9ap/
# System Authorization Information
Auth--useshadow--passalgo=sha512
# Use graphical Install
Graphical
Firstboot--disable
# System Keyboard
Keyboard US
# System Language
Lang ZH_CN
# SELinux Configuration
SELinux--disabled
# Installation Logging Level
Logging--level=info
# Reboot after installation
Reboot
# System TimeZone
TimeZone Asia/shanghai
# System Bootloader Configuration
Bootloader--location=mbr--md5pass= "$1$ply03ale$ljjfazl5igir7kbfr2q0j1"
# Partition Clearing Information
Clearpart--all
# Disk Partitioning Information
Part/boot--fstype= "Ext4"--size=200
Part swap--fstype= "swap"--size=2000
Part/--fstype= "EXT4"--grow--size=1
%post--interpreter=/bin/bash #这里在最后一步中我定义了脚本, yum source
rm-rf/etc/yum.repos.d/*
Echo ' [Yum]
name=yum_rpm
Baseurl=http://http Address/yum_rpm/
Enable=1
Gpgcheck=0
[Epel]
name=epel_rpm
Baseurl=http://http Address/epel_rpm/
Enable=1
Gpgcheck=0 ' >/etc/yum.repos.d/yum.repo
%end
%packages
@development
@system-MANAGEMENT-SNMP
%end
Service VSFTPD Restart
Service DHCPD Restart
Service xinetd Restart
Error 1: Unable to select software after using the System-config-kickstart command
WORKAROUND: A new Yum source must be created locally I'm using a CD.
[DVD]
Name=dvd
Baseurl=file:///var/ftp/cdrom
Enabled=1
Gpgcheck=0
Error 2: CentOS prompts an error with occurred. -No valid devices were found
Workaround: Replace the disc
Unattended PXE installation