Linux system Pxe+kickstart Automatic installation system

Source: Internet
Author: User
Tags file transfer protocol

First, PXE
PXE (Pre-Boot execution Environment, pre-boot execution Environment) is the latest technology developed by Intel Corporation, working in the Client/server network mode, enabling workstations to download images from remote servers over the network, This supports booting the operating system over the network, and during the boot process, the terminal requires the server to assign an IP address, then TFTP (trivial File Transfer Protocol) or MTFTP (Multicast trivial file transfer Protocol) protocol to download a boot package into native memory executed by this boot package to complete the terminal basic software setup, thus booting the terminal operating system preinstalled in the server.

Second, PXE workflow
①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);
③PXE client requests the pxelinux.0 file from the TFTP server in the network;
④PXE client obtains pxelinux.0 file and executes the file;
⑤ load the kernel and file system via the TFTP server based on the results of pxelinux.0 execution;
⑥ into the installation screen, at this time can be selected by HTTP, FTP, one of the NFS mode to install;


Third, Kickstart
Kickstart is an unattended installation, which works by documenting typical parameters that require manual intervention during installation, and generates a file called Ks.cfg. If you have to fill in the parameters during the installation process (not limited to the machine that generated the Kickstart installation files), the installer will first look for the files generated by the kickstart, and if the appropriate parameters are found, use the found parameters; Requires manual intervention by the installer. Therefore, if the kickstart file covers all of the parameters that may be required to be filled in during the installation, you can implement a fully automated installation.

Iv. Walkthrough Testing
Walkthrough Environment
VMware Workstation 12
CentOS 6.5
LAN Section # Note: Turning off the DHCP capabilities of the VM network will have an impact
Dhcp/tftp/nfs ip:192.168.157.129
Iptables & SElinux off

Prepare
1, configure the Yum source (this walkthrough uses system image to do yum bin)
① Mounting Discs
[root]# mount/dev/cdrom/mnt
[root]# Echo '/dev/cdrom/mnt iso9660 defaults 0 0 ' >>/etc/fstab# #开机自动挂载
② Configuring Yum
[root]# Cat/etc/yum.repos.d/iso.repo
[ISO]
Name=iso
Baseurl=file:///mnt
Enabled=1
Gpgcheck=0

2. Configure DHCP
① Installation
[root]# yum–y Install DHCP
② Modify the configuration file (note the semicolon and other formatting issues)
[root]# cat/etc/dhcp/dhcpd.conf
Ddns-update-style none;
Ignore client-updates;
FileName "pxelinux.0";
Next-server 192.168.157.129; IP address of the #TFTP server
Subnet 192.168.157.0 netmask 255.255.255.0 {#所属网段掩码
option routers 192.168.157.2; #路由器IP, writable managed IP
Option Subnet-mask 255.255.255.0;
Range 192.168.157.200 192.168.157.230; #IP地址池
Default-lease-time 21600;
Max-lease-time 43200;
}
③ Starting the DHCP service
[root]#/ETC/INIT.D/DHCPD start
[root]# chkconfig DHCPD on

3. Configuring NFS Server shared Files
① Installing NFS Server
[root]# yum–y Install Nfs-utils
② creating a shared directory, storing the image file
[root]# Mkdir/dvd
[root]# cp–r/mnt/*/dvd
[root]# cat/etc/exports# shared directory
/dvd* (rw)
③ Start the NFS service, check file sharing
[root]#/etc/init.d/rpcbind start #要先启动rpcbind否则会有异常, detailed reference to how NFS works
[root]#/etc/init.d/nfs start
[root]# Showmount–e
Export list for example.com
/dvd*
4. Configuring the TFTP server
① Installation
[root]# yum–y Install Tftp-server
② Modifying a configuration file
[root]# vim/etc/xinetd.d/tftp
Service TFTP
{
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/var/lib/tftpboot
Disable = no# will modify Yes to No
Per_source = 11
CPS = 100 2
Flags = IPV4
}
③ Start Service
[root]#/etc/init.d/xinetd start
[root]# chkconfig xinetd on

5. Configure the files required for PXE boot
① installation Syslinux
[root]# yum–y Install Syslinux
Note: Syslinux is a powerful bootloader and is compatible with a variety of media. Syslinux is a small Linux operating system that is designed to simplify the first time you install Linux and to build other special-purpose boot disks after the repair.
③ copying related files to/var/lib/tftpboot/
[root]# cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
[root]# cp/dvd/images/pxeboot/initrd.img/var/lib/tftpboot/
[root]# cp/dvd/images/pxeboot/vmlinuz/var/lib/tftpboot/
[root]# cp/dvd/isolinux/*.msg/var/lib/tftpboot/
④ Creating and configuring related files
[root]# mkdir-p/var/lib/tftpboot/pxelinux.cfg
[root]# Cp/dvd/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default
[root]# chmod U+w/var/lib/tftpboot/pxelinux.cfg/default
[root]# Vim/var/lib/tftpboot/pxelinux.cfg/default
Default KS
Prompt 1
Timeout 6
Display Boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
Label Linux
Kernel Vmlinuz
Append initrd=initrd.img
Label text
Kernel Vmlinuz
Append initrd=initrd.img Text
Label KS
Kernel Vmlinuz
Append ks=nfs:192.168.157.129:/dvd/ks.cfg initrd=initrd.img
Label Local
Localboot 1
Label Memtest86
Kernel memtest
Append-
6. Generate Ks.cfg File
Ks.cfg is the Kickstart installation configuration file, the system is installed ks.cfg to install.
① Installation Kickstart
[root]# yum–y Install System-config-kickstart
② start graphical Kickstart generation Ks.cfg
[root]# System-config-kickstart









Save under/root/, there is also a anaconda-ks.cfg file in the same directory, copy the software installation script in this file to Ks.cfg (that is,%packages to%end)
Finally copy the Ks.cfg file to the shared directory to/dvd

You can turn on a virtual machine installation verification configuration

Linux system Pxe+kickstart Automatic installation system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.