In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use PXE+Kickstart to achieve unattended installation, the article is very detailed, has a certain reference value, interested friends must read it!
I. brief introduction
1.1 what is PXE
PXE (Pre-boot Execution Environment, pre-boot execution environment) is the latest technology developed by Intel, which works in the network mode of Client/Server. It supports workstations to download images from remote servers through the network, and thus supports booting the operating system through the network. During the startup process, the terminal requires the server to assign an IP address, and then download a startup software package to the local memory for execution using the TFTP protocol. The startup package completes the basic software settings of the terminal, thereby booting the terminal operating system pre-installed in the server.
Strictly speaking, PXE is not an installation method, but a boot mode. The necessary condition for PXE installation is that a PXE-supported network card (NIC) must be included in the computer to be installed, that is, there must be PXE Client in the network card. The PXE protocol enables computers to start over the network. This protocol is divided into Client side and Server side, while PXE Client is in the ROM of the network card. When the computer boots, BIOS calls the PXE Client into memory for execution, and then PXE Client downloads the files placed at the remote end to run locally through the network. Running the PXE protocol requires setting up a DHCP server and a TFTP server. The DHCP server assigns an IP address to the PXE Client (the host on which the system will be installed), and since the IP address is assigned to the PXE Client, you need to add the corresponding PXE settings when configuring the DHCP server. In addition, TFTP Client already exists in PXE Client's ROM, so it can download the required files to TFTP Server through the TFTP protocol.
The working process of PXE:
\ 1. PXE Client starts from its own PXE network card and requests IP; from the DHCP server in this network. 2. The DHCP server returns the IP assigned to the client and the location of the PXE file (usually on a TFTP server);\ 3. PXE Client requests the pxelinux.0 file from the TFTP server in the network;\ 4. Execute the file after PXE Client gets the pxelinux.0 file;\ 5. According to the execution result of pxelinux.0, load the kernel and file system through the TFTP server;\ 6. Enter the installation screen, and you can install it by selecting one of HTTP, FTP or NFS methods.
For detailed workflow, please refer to the following figure:
1.2 what is Kickstart
Kickstart is an unattended installation. It works by recording various parameters that typically require human intervention during installation and generating a file called ks.cfg. If parameters are to be filled in during the installation process (not limited to the machine that generates the Kickstart installation files), the installer will first look for the files generated by Kickstart, and if it finds the right parameters, it will use the parameters found; if the appropriate parameters are not found, the installer will need to intervene manually. So, if the Kickstart file covers all the parameters that may need to be filled in during the installation process, then the installer can just tell the installer where to get the ks.cfg file and go about his own business. When the installation is complete, the installer will restart the system according to the settings in ks.cfg and finish the installation.
The complete process of PXE+Kickstart unattended installation of the operating system is as follows:
II. System environment
Lab environment: VMware Workstation 10
System platform: CentOS release 6.5 (minimized installation)
Network mode: NAT mode (IP address of shared host)
DHCP / TFTP IP:192.168.111.130
HTTP / FTP / NFS IP:192.168.111.130
Close Iptables and SELINUX
III. Preparatory work
The system-config-kickstart tool is needed to generate the ks.cfg file, and this tool depends on X Windows, so we need to install X Windows and Desktop and restart the system as follows:
# yum groupinstall "X Window System" # yum groupinstall Desktop# yum groupinstall Fonts# reboot
Configure the installation mode of HTTP
4.1 install and configure HTTP, start the service and boot automatically
# yum install httpd-y # / etc/init.d/httpd start# chkconfig-- level 35 httpd on
4.2 load ISO image
Set the load ISO image in the virtual machine: Mount the iso file to / mnt/cdrom:
4.3 copy all the contents of the CD to the root directory / var/www/html/ of http
# cp-r / mnt/cdrom/ / var/www/html/
5. Configure TFTP
5.1 install tftp-server
# yum install tftp-server-y
5.2 enable tftp Service tftp-server
# vi / 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 per _ source = 11 cps = 100 2 flags = IPv4}
5.3 start the tftp service tftp-server
Because the tftp service is mounted under the super process xinetd, start the tftp service by starting xinetd and boot self-starting xinetd:
# / etc/init.d/xinetd restart# chkconfig xinetd on
Configure the startup program that supports PXE
6.1 copy the pxelinux.0 file to the / var/lib/tftpboot/ folder
# cp / usr/share/syslinux/pxelinux.0 / var/lib/tftpboot
Description: syslinux is a powerful boot loader and compatible with a variety of media. More specifically: SYSLINUX is a small Linux operating system designed to simplify the time it takes to install Linux for the first time and to create a boot disk for repair or other special purposes.
6.2 copy the / image/pxeboot/initrd.img and vmlinux in the iso image to the / var/lib/tftpboot/ folder
# cp / var/www/html/cdrom/images/pxeboot/ {initrd.img,vmlinuz} / var/lib/tftpboot/
6.3 copy / isolinux/*.msg in the iso image to / var/lib/tftpboot/ folder
# cp / var/www/html/cdrom/isolinux/*.msg / var/lib/tftpboot/
6.4 create a new pxelinux.cfg directory in / var/lib/tftpboot/
# mkdir / var/lib/tftpboot/pxelinux.cfg
6.5 copy the isolinux.cfg in the / isolinux directory in the iso image to the pxelinux.cfg directory and change the file name to default
# cp / var/www/html/cdrom/isolinux/isolinux.cfg / var/lib/tftpboot/pxelinux.cfg/default
6.6 modify the default file
# vi / var/lib/tftpboot/pxelinux.cfg/default
By default, default ks # starts the boot kernel prompt 1 # marked in 'label ks'' that displays the prompt 'boot:'. When'0' is not prompted, the content specified in the 'default' parameter will be started directly. The timeout of timeout 6 # before user input, in units of 1 to 10 seconds. Display boot.msg # displays the contents of a file. Note the path to the file. The default is in the / var/lib/tftpboot/ directory. It can also refer to locating a path + file name like'/ install/boot.msg'. F1 boot.msg # the file that is displayed after pressing a key such as'F1'. F2 options.msg F3 general.msg F4 param.msg F5 rescue.msg label linux # 'label' specifies the keywords you enter at the' boot:' prompt, such as boot: linux [ENTER], which launches the kernel and initrd.img files marked under 'label linux'. The kernel vmlinuz # kernel parameter specifies the kernel to boot. Append initrd=initrd.img # append specifies parameters appended to the kernel, and parameters appended to the kernel that can be used in grub can also be used here. Label text kernel vmlinuz append initrd=initrd.img text label ks kernel vmlinuz append ks= http://192.168.111.130/ks.cfg initrd=initrd.img # tells the system where to get the ks.cfg file label local localboot 1 label memtest86 kernel memtest append-
7. Configure DHCP
7.1 install the DHCP service
# yum-y install dhcp
7.2 copy the configuration template file to the configuration directory of DHCP
# cp- f / usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample / etc/dhcp/dhcpd.conf
7.3 modify the / etc/dhcp/dhcpd.conf configuration file as follows:
Ddns-update-style interim; ignore client-updates; filename "pxelinux.0"; # pxelinux startup file location; next-server 192.168.111.130; # TFTP Server IP address; subnet 192.168.111.0 netmask 255.255.255.0 {option routers 192.168.111.130; option subnet-mask 255.255.255.0 Range dynamic-bootp 192.168.111.100 192.168.111.200; default-lease-time 21600; max-lease-time 43200;}
7.4 start the DHCP service
# / etc/init.d/dhcpd start
8. Generate ks.cfg files
8.1 install Kickstart
# yum install system-config-kickstart
Start the X Windows environment
# startx
Configure Kickstart
# system-config-kickstart
a. Set language, keyboard, time zone, Root password, restart after installation, etc. b. Set the installation mode, this article introduces the installation of HTTP mode, so choose HTTP
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
c. Install MBR
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
d. Set Partition
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
e. Zone overview
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
f. Configure the network
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
g. Authentication configuration
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
H. SELinux and firewall configuration
i. Graphic environment configuration
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
j. Package installation selection
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
k. Preview
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
l. Generate a ks.cfg file and save it in the / var/www/html/ folder
CentOS6 PXE+Kickstart unattended installation CentOS6 PXE+Kickstart unattended installation
9. Test the installation
\ 1. Create a virtual machine\ 2. Start the virtual machine, choose to boot from the network card, and the DHCP server is assigning an IP address to the client.
\ 3. Start downloading vmlinuz and initrd.img\ 4. Installation process …
The above is all the contents of the article "how to use PXE+Kickstart to achieve unattended installation". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.