What is Kickstart Installations?
Kickstart Installations for unattended automatic installation
Kickstart files, which are ready before installation, can be used to automatically perform the installation. It can be saved on a single server system and supports one to many: that is, a single file installs CentOS on multiple computers
All Kickstart scripts and logs are also stored in the directory
Start the installation process
Methods to start the installation: DVD, NFS, FTP, HTTP/HTTPS, Hard drive
Process: 1. Create startup file
2. Make Kickstart files available on removable media, hard disk drive or network location
3. Create startup media (install source) for installation
4. Make the installation source available
5. Start Kickstart Installations
-
Create startup file
If there is CentOS installed, an anaconda-ks.cfg file will be generated in the / root directory.
PS: ා is to be executed by root user; $is to be executed by any user, and the following are based on this standard
1: You can install it through ios image according to CentOS requirements, so that you can get a Kickstart configuration file that doesn't need to be modified
# cd /root > ls > anaconda-ks.cfg
2: Use Kickstart Configuration Tool to create and modify Kickstart configuration files
#Yum install system config kickstart? Install K...C...Tool #System config kickstart? Start K...C...Tool
Verify Kickstart profile
Using ksvalidator to verify the configuration file syntax of Kickstart
# yum install pykickstart $ksvalidator /path/to/kickstart.ks ා path to kcikstart file
Kickstart profile reference
Save the file (ks.cfg), which will be used later
#platform=x86, AMD64, or Intel EM64T #version=DEVEL # Install OS instead of upgrade install # Keyboard layouts keyboard 'us' # Root password rootpw --plaintext 123456 # Use network installation url --url="http://192.168.1.101/CentOS/7/repo" # System language lang en_US # User agreement eula --agreed # System authorization information auth --useshadow --passalgo=sha512 # Use text mode install text firstboot --disable # SELinux configuration selinux --disabled # Firewall configuration firewall --disabled # Network information network --bootproto=dhcp --device=ens33 # Reboot after installation reboot # System timezone timezone Asia/Shanghai --isUtc user --groups=wheel --name=admin --password=$6$dFOvxfykHlSQW0Al$lYq0jhdvX0MzJsfF5poagu2tRGdb9 //xrzTIvfF6JKE1q2yflO19nGZf/A77/Pyp0vIjmk7f31gFmrtrypxBa/ --iscrypted --gecos="admin" # System bootloader configuration bootloader --location=none # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all # Disk partitioning information part /boot --fstype="xfs" --size=1024 part swap --fstype="xfs" --size=2048 part / --fstype="xfs" --grow --size=1 %packages @additional-devel @base @core @debugging @basic-desktop @desktop-debugging @desktop-platform @desktop-platform-devel @development @directory-client @eclipse @emacs @fonts %end
Create startup media
Kickstart files must be placed in one of the following locations
-
On removable media, such as DVD or USB flash drives
PS: burn the full iso to DVD and set the computer to boot from this disk
-
Connect to the hard disk of the installation system
PS: put the complete iso on the hard disk / USB to install the system
-
On a network share accessible from the installation system
PS: copy the iso image or installation tree to the network accessible from the installation system, and install through the network
Make Kickstart files available
Select the network-based method here: PXE network server starts, Kickstart files are downloaded from the network share, and the software package specified in the file is downloaded from the remote repository
Build yum source
# yum install httpd
# systemctl enable httpd # systemctl start httpd # mkdir -p /var/www/html/CentOS/7/repo #For iso # mount -r /path/to/iso /var/www/html/CentOS/7/repo #/path/to/iso your iso pathbuild tftp server
# yum install tftp-server
# systemctl enable tftp # systemctl start tft
# Turn off firewall # firewall-cmd --add-service=tftpto configure DHCP server
No place to configure network startup ip,Can only be acquired automatically
# yum install dhcp#vi /etc/dhcp/dhcpd.conf # # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.example # see dhcpd.conf(5) man page # option space pxelinux; option pxelinux.magic code 208 = string; option pxelinux.configfile code 209 = text; option pxelinux.pathprefix code 210 = text; option pxelinux.reboottime code 211 = unsigned integer 32; option architecture-type code 93 = unsigned integer 16; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.101 192.168.1.130; option routers 192.168.1.1; class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; next-server 192.168.1.1; if option architecture-type = 00:07 { filename "uefi/shim.efi"; } else { filename "pxelinux/pxelinux.0"; } } }
Set auto start
# systemctl start dhcpd # systemctl enable dhcpd
Configure PXE boot file
# yum install syslinux #The default directory of tftp is / var/lib/tftpboot # mkdir -p /var/lib/tftpboot/pxelinux # cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux #Note: pxelinux.0 may be different
Create Startup menu
default vesamenu.c32 prompt 1 font myfont.psf menu clear menu background background.png menu title PXE menu vshift 8 menu rows 18 menu margin 8 menu helpmsgrow 15 menu tabmsgrow 13 menu color border * #00000000 #00000000 none menu color sel 0 #ffffffff #00000000 none menu color title 0 #ff7ba3d0 #00000000 none menu color tabmsg 0 #ff3a6496 #00000000 none menu color unsel 0 #84b8ffff #00000000 none menu color hotsel 0 #84b8ffff #00000000 none menu color hotkey 0 #ffffffff #00000000 none menu color help 0 #ffffffff #00000000 none menu color scrollbar 0 #ffffffff #ff355594 none menu color timeout 0 #ffffffff #00000000 none menu color timeout_msg 0 #ffffffff #00000000 none menu color cmdmark 0 #84b8ffff #00000000 none menu color cmdline 0 #ffffffff #00000000 none menu separator menu separator timeout 100 label 1 menu label ^1)Install CentOS7 x86_64(KickStart) kernel images/CentOS/7/vmlinuz append initrd=images/CentOS/7/initrd.img inst.ks=http://192.168.1.101/CentOS/7/ks.cfg ksdevice= inst.repo=http://192.168.1.101/CentOS/7/repo label 2 menu label ^2)Install CentOS7 x86_64(Manual) kernel images/CentOS/7/vmlinuz append initrd=images/CentOS/7/initrd.img ksdevice= inst.repo=http://192.168.1.101/CentOS/7/repo
CentOS Kickstart files
Make the installation source available. The default Startup menu specifies the kernel file. If it does not, it cannot be started normally.
# mkdir -p /var/lib/tftpboot/pxelinux/CentOS/7/ # cp /path_to_x86_64_images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/images/CentOS/7/ PS: / path to x86 64 images: unknown path, find pxeboot path through find / -name "pxeboot"