Kickstart Unattended Installation
PXE Introduction
PXE (Pre-Boot execution Environment, pre-Boot execution Environment ) is the latest technology developed by Intel Corporation, working in the Client/server network mode , supports workstations to download images from remote servers over the network, and thus supports booting the operating system over a network, during startup, the terminal requires the server to assign IP addresses, and then TFTP(trivial file transfer Protocol) or mtftp (multicasttrivial File Transfer Protocol) protocol to download a boot package to native memory execution, completed by this boot package terminal basic software setup, This directs the terminal operating system to be pre-installed in the server.
strictly speaking,Pxeis not a way of installation, but a way of booting. MakePxeThe prerequisite for installation is that the computer to be installed must contain aPxeSupported network cards (Nic), that is, the NIC must havePXE Client. Pxethe protocol enables the computer to boot over the network. This agreement is divided intoClientEnd andServerend, andPXE Clienton the NIC'sRomthe. When the computer boots,BiosputPXE Clientis transferred into memory and then executed by thePXE ClientThe files placed on the remote side are downloaded to the local run through the network. RunPxeThe protocol needs to be setDhcpservers, andTftpserver. Dhcpserver will givePXE Client(the host that will install the system) assigns aIpaddress, as is given toPXE ClientDistributionIpaddress, so in the configurationDhcpserver, you need to add the appropriatePxesettings. In addition, thePXE Clientof theRom, there is already aTFTP Client, then it can be passedTftpAgreement toTFTP ServerDownload the required files.
2. Unattended installation schematic diagram :
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/76/10/wKiom1ZJjJ3zLUGOAABQ53jZlTs694.png "title=" Kickstart schematic. png "alt=" Wkiom1zjjj3zlugoaabq53jzlts694.png "/>
working process for PXE:
PXE Client starts from its own PXE network card and requests IP from the DHCP server in the network;
The DHCP server returns the IP that is assigned to the client and the location of the PXE file ( The file is typically placed on a TFTP server ) ;
The PXE Client requests the pxelinux.0 file from the TFTP server in the network ;
The PXE Client executes the file after obtaining the pxelinux.0 file;
load kernel and file system via TFTP server according to pxelinux.0 execution result ;
into the installation screen , at this time can be selected by HTTP,FTP, One of the modes of NFS installation;
Detailed workflow, please refer to the following picture:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/76/0D/wKioL1ZJjKazv2yKAAETsoA9dhM358.png "title=" PXE Flowchart. png "alt=" Wkiol1zjjkazv2ykaaetsoa9dhm358.png "/>
3. Environmental requirements
Experimental environment |
VMware Workstations 11.0 |
System Platform |
CentOS6.7(Final minimized installation) |
Network Adoption Nat |
Gateway 10.0.0.2 |
NFS,TFTP server address |
10.0.0.9 |
DHCP Server Address |
10.0.0.9 |
4. Operation procedure:
To create a mount directory:
Mkdir/data/sys–p
The directory sys is read-only because we have this one mounted .
I need to put ks.cfg also in the share, I will create a Kickstart directory under the data directory
Mkdir/data/kickstart-p
We are using a virtual machine: Do not copy the image to this directory, we mount the image to this directory. If it is the real environment we need to copy the image to this directory.
[Email protected]/]# Mount/dev/cdrom/data/sys
Mount:block Device/dev/sr0 is write-protected, mounting read-only
[Email protected]/]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda2 6.9G 3.7G 2.9G 57%/
Tmpfs 238M 4.0K 238M 1%/DEV/SHM
/DEV/SDA1 190M 36M 145M 20%/boot
/dev/sr0 3.7G 3.7G 0 100%/data/sys
2. Installation Server for NFS ;
Query is not installed
[Email protected]/]# Rpm-qa Nfs-utilsrpcbind
Rpcbind-0.2.0-11.el6.x86_64
Nfs-utils-1.2.3-64.el6.x86_64
not installed by Yum to install
[Email protected]/]# yum-y installnfs-utils rpcbind
After installation, the two services are added to boot from the boot.
[[email protected]/]# chkconfig NFS on
[Email protected]/]# chkconfig rpcbind on
and set the/data/sys as the shared directory
echo "/DATA/SYS10.0.0.0/24 (Ro,sync)" >>/etc/exports
echo "/DATA/KICKSTART10.0.0.0/24 (Ro,sync)" >>/etc/exports
Start NFS Services
/etc/init.d/rpcbind start
/etc/init.d/nfs start
To view the shared directory:
[Email protected]/]# showmount-e localhost
Export list for localhost:
/data/kickstart 10.0.0.0/24
/data/sys 10.0.0.0/24
3. Installation TFTP Service:
[Email protected]/]# yum-y installtftp-server*
Setup Complete Modify configuration file change disable Yes to no default Server_args is in /var/lib/ under the Tftpboot. We can change to/tftpboot by default.
Vim/etc/xinetd.d/tftp
Service TFTP
{
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/tftpboot
Disable = no
Per_source = 11
CPS = 100 2
Flags = IPV4
}
Mkdir/tftpboot directory.
Add xinetd to boot
Chkconfig xinetd on
[Email protected]/]# chkconfig--list|grep xinetd
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4. Configuration Support PXE Boot configuration:
copy The pxelinux.0 file to the/tftpboot/folder
cp/usr/share/syslinux/pxelinux.0/tftpboot/
copy the/image/pxeboot/initrd.img and vmlinux to /tftpboot/ folders in the ISO image
cp/data/sys/images/pxeboot/initrd.img/tftpboot/
cp/data/sys/images/pxeboot/vmlinuz/tftpboot/
Create a pxelinux.cfg directory under the tftpboot directory
mkdir/tftpboot/pxelinux.cfg/-P
Copy the Isolinux.cfg file in the image to pxelinux.cfg and rename it to default
Cp/data/sys/isolinux/isolinux.cfg/tftpboot/pxelinux.cfg/default
[Email protected] sys]# chmod u+w/tftpboot/pxelinux.cfg/default
Modify a file
Default Linux # boot linux flag kernel
Prompt 1
Timeout 6
# and tell the system where to get the ks.cfg file
Label Linux
Menu Label ^install or upgradean existing system
Menu default
Kernel Vmlinuz
Appendinitrd=initrd.img text Append ks=nfs:10.0.0.9:/data/kickstart/ks.cfg
5. Installation DHCP Service:
Yum-y Install dhcp*
after installing the DHCP joins the boot-up.
Chkconfig DHCPD on
[Email protected]/]# chkconfig--list|grep dhcpd
DHCPD 0:off 1:off 2:off 3:on 4:off 5:off 6:off
Copy template configuration file to /etc/dhcp/
Cp-f/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
Modify The/etc/dhcp/dhcpd.conf configuration file with the following content :
Ddns-update-style none;
Ignore client-updates;
Allow booting;
Allow BOOTP;
Default-lease-time 21600;
Max-lease-time 43200;
Option routers 10.0.0.2; # Gateway
Option Subnet-mask 255.255.255.0; # Subnet Mask
Subnet 10.0.0.0 netmask 255.255.255.0 {
Range dynamic-bootp10.0.0.100 10.0.0.199;
Next-server 10.0.0.9; # Service IP address
FileName "/data/sys/kickstart/ks.cfg"; #ks. CFG location
Next-server 10.0.0.9; # Server IP address
FileName "pxelinux.0"; #pxe start the civilian
}
6. Generate the ks.cfg file
can be generated by the system, using System-config-kickstart to generate ks.cfg
# Kickstart file automatically generated by Anaconda.
#version =devel
Install
NFS--server=10.0.0.9--dir=/data/sys # specifies where to load system images from
Lang en_US. UTF-8
Keyboard US
Network--onboot Yes--device eth0--bootproto DHCP--noipv6
ROOTPW 123456 # root password
Firewall--disabled
Authconfig--enableshadow--passalgo=sha512
SELinux--disabled
TimeZone--UTC Asia/shanghai
Bootloader--location=mbr--driveorder=sda--append= "Crashkernel=auto rhgb quiet"
Logging--level=info
Zerombr
# The following is the partition information you requested
# Note that any partitions deleted is not expressed
# unless you clear all partitions first
# Guaranteed to work
#clearpart--none
#part/boot--fstype=ext4--size=200
#part/--FSTYPE=EXT4--grow--asprimary--size=200
#part Swap--size=768
Clearpart--all
Part/boot--FSTYPE=EXT4--size=200
Part/--FSTYPE=EXT4--grow--asprimary--size=200
Part swap--size=768
%packages
@base
@compat-libraries
@core
@debugging
@development
@server-policy
@workstation-policy
Python-dmidecode
Sgpio
Device-mapper-persistent-data
Systemtap-client
%end
These are all well-equipped. Check service turned on No
[Email protected]/]#/ETC/INIT.D/NFS status
RPC.SVCGSSD is stopped
RPC.MOUNTD (PID 16194) is running ...
NFSD (PID 16210 16209 16208 16207 16206 16205 16204 16203) isrunning ...
Rpc.rquotad (PID 16189) is running ...
[Email protected]/]#/etc/init.d/rpcbind status
Rpcbind (PID 18430) isrunning ...
[Email protected]/]#/etc/init.d/xinetd status
XINETD (PID 17055) isrunning ...
[Email protected]/]#/ETC/INIT.D/DHCPD status
DHCPD (PID 16262) isrunning ...
Next we create an empty virtual machine in VMware.
Boot test.
This article is from the "Tomxia" blog, make sure to keep this source http://2852856.blog.51cto.com/2842856/1713130
Kickstart unattended Installation