In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
PXE (preboot execute 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. Then use TFTP (trivial file transfer protocol) or MTFTP (multicast trivial file transfer protocol) protocol to download a startup package into local memory for execution, and the startup package completes the terminal basic software settings, thus booting the terminal operating system pre-installed in the server. PXE can boot a variety of operating systems, such as Windows95/98/2000/windows2003/windows2008/win7/win8,linux.
1. Introduction of system environment
Virtual machine software: VirtualBox
Virtual machine network connection method: host (Host-Only) network only
Server operating system: CentOS 7
Configuration service: DHCP+TFTP+FTP (you can also use HTTP, NFS, etc.)
Complete the goal: build the pxe environment, combined with the kickstart response file, complete the automatic installation of the CentOS 7 system.
1.1 introduction of server and boot file
Main document
When the system is installed, the system installation interface can not be seen until the kernel file is loaded by the boot file.
Pxelinux.0-system boot file
Vmlinuz, initrd.img-kernel file
DHCP server
Provide the client with the necessary network information, such as IP, netmask, gateway, dns, etc., and provide the location of the boot file (pxelinux.0) and the address of the TFTP server to the client.
TFTP server
Kernel files and boot files are mainly provided for the client.
FTP server
Provide the client with kickstart response files and system image files.
When installing the pxe system, the dhcp server first provides the client with information such as IP, the location of the boot file and the tftp address. After obtaining the relevant information, the client downloads the boot file and kernel file through TFTP to boot the system, and downloads the software packages and kickstart response files needed in the process of system installation through the ftp server.
Kickstart response file is mainly used to automatically set time zone, password, system partition, package selection and other information.
1.2 Server-side detailed environment
The detailed system environment is:
[root@pxe1 ~] # uname-aLinux pxe1 3.10.0-514.el7.x86_64 # 1 SMP Tue Nov 22 16:42:41 UTC 2016 x 86 "64 GNU/Linux [root@pxe1 ~] # [root@pxe1 ~] # hostnamectl Static hostname: pxe1 Icon name: computer-vm Chassis: vm Machine ID: 18ef8dea83044565b82bf6bed368cdab Boot ID: 9beedf23c4e14016a0a458ddcd9c487b Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-514.el7.x86_64 Architecture: x86-64 [root@pxe1 ~] # cat / etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.56.14 pxe1 [root@pxe1 yum.repos.d] # ifconfig enp0s3: flags=4163 mtu 1500 inet 192.168.56. 14 netmask 255.255.255.0 broadcast 192.168.56.255 inet6 fe80::a00:27ff:fe43:c11d prefixlen 64 scopeid 0x20 ether 08:00:27:43:c1:1d txqueuelen 1000 (Ethernet) RX packets 1441 bytes 121057 (118.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 928 bytes 98905 (96.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0.. 1.3 server initial environment preparation
Turn off SELinux and firewall:
# for the convenience of subsequent configuration, first shut down the system SELinux and firewall # close SELinux Modify the file so that SELINUX=disabled [root@pxe1 ~] # vim / etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing-SELinux security policy is enforced.# permissive-SELinux prints warnings instead of enforcing.# disabled-No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of three two values:# targeted-Targeted processes are protected,# minimum-Modification of targeted policy. Only selected processes are protected. # mls-Multi Level Security protection.SELINUXTYPE=targeted# takes effect after restarting the system. Check the status of SELinux. [root@pxe1 ~] # sestatus SELinux status: disabled# turn off firewall [root@pxe1 ~] # systemctl stop firewalld [root@pxe1 ~] # systemctl disable firewalld [root@pxe1 ~] # systemctl status firewalld ● firewalld.service-firewalld-dynamic firewall daemon Loaded: loaded (/ usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld (1) 1.4 client environment preparation
Create a new linux virtual machine in VirtualBox:
Name: fill in casually
Type: linux
Version: Red Hat (64-bit)
Virtual hard disk:
Now create a virtual hard disk and pay attention to allocating enough hard disk size to avoid installation failure due to insufficient hard disk space. I choose 20g here for dynamic allocation.
Boot sequence: network startup ranks first.
Setting method: select the new virtual machine, set-- system-- motherboard-- boot sequence-- set the network to the first place.
Network: host-only (Host-Only) network
Setting method: select the new virtual machine, set-- Network-- Network card 1-enable network connection-- connection method: Host-Only
two。 Configure yum Feed
This paper mainly introduces the method of configuring the local yum source using the system CD.
First mount the system CD:
Click the CD icon in the lower right corner of the virtual machine and select the system image file that needs to be mounted.
Create a yum source profile:
# first mount the CD to the / mnt directory [root@pxe1 ~] # umount / dev/cdrom-l [root@pxe1 ~] # mount / dev/cdrom / mnt/mount: / dev/sr0 is write-protected Mounting read-only# creates yum configuration file [root@pxe1] # cd / etc/yum.repos.d/ [root@pxe1 yum.repos.d] # lsCentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-fasttrack.repoCentOS-CR.repo CentOS-Media.repo CentOS-Vault.repo# to avoid the influence of repo files in the system First back it up [root@pxe1 yum.repos.d] # mkdir bak [root@pxe1 yum.repos.d] # mv *. Repo bak/ [root@pxe1 yum.repos.d] # lsbak [root@pxe1 yum.repos.d] # vim my.repo [development] ls227 Entering Passive Mode (192 Here comes the directory listing.-rw-r--r-- 1 1459 May 25 09:36 ks.cfgdrwxr-xr- X 8 2048 Dec 05 13:20 pub226 Directory send OK.ftp > get ks.cfglocal: ks.cfg227 Entering Passive Mode: ks.cfg227 Entering Passive Mode (192 bytes 168 56 secs 14152101) .150 Opening BINARY mode data connection for ks.cfg (1459 bytes) .226 Transfer complete.1459 bytes received in 0.0433 secs (33.68 Kbytes/sec) ftp > bye221 Goodbye. [root@pxe1 kk] # lsks.cfg
Successful get to the ks.cfg file indicates that the configuration is normal, and now you can restart the client virtual machine to test whether the automatic system installation can be carried out.
7. Automated system installation testing
Restart the client virtual machine and you can see that the system begins to install automatically. At this point, the pxe+kickstart automatic system installation configuration is complete.
8. Introduction to the Boot menu
The main contents of the boot menu default configured in this article are as follows:
Label linux menu label ^ Install CentOS Linux 7 by kickstart menu default kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.ks= ftp://192.168.56.14/ks.cfglabel linux 2 menu label ^ Install CentOS Linux 7 by vnc kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.vnc inst.vncpassword=passwordlabel linux 3 menu label ^ Install CentOS Linux 7 by vnc-listen kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.vnc inst.vncconnect=192.168.56.1
During the system startup process, the menu corresponds to the following in turn:
8.1 introduction to the kickstart menu
An introduction to the menu:
Label linux menu label ^ Install CentOS Linux 7 by kickstart menu default kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.ks= ftp://192.168.56.14/ks.cfg# uses kickstart automatic installation # this menu indicates that the image file is in the FTP root directory / var/ftp/pub and the kickstart file is in the FTP root directory / var/ftp.
Menu 2 introduces:
Label linux 2 menu label ^ Install CentOS Linux 7 by vnc kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.vnc inst.vncpassword=password # manually install using vnc # this menu indicates that the image file is in the FTP root directory / var/ftp/pub, and the vnc password is password. When this menu is selected, the system will prompt the IP and port of vnc login after startup. After vnc connection, manual system installation can be carried out. You can also specify the kickstart file location at the end of the menu and install it automatically.
As shown in the figure:
The third menu describes:
Label linux 3 menu label ^ Install CentOS Linux 7 by vnc-listen kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.vnc inst.vncconnect=192.168.56.1 # this menu item indicates that the system is installed using vnc listening mode # this menu indicates that the image file is in the FTP root directory / var/ftp/pub, and the vnc listening process is on computer 192.168.56.1 without a login password # Note: inst.vncconnect=192.168.56.1 refers to the IP address of the computer that will be running the vnc client.
192.168.56.1 here is my notebook IP, so after starting the client virtual machine, you only need to turn on vnc client listening mode on the notebook to automatically display the installation interface.
After you turn on vnc listening mode on your laptop, wait a while, and you will automatically connect to the system installation interface:
9. Other creation methods of boot menu 9.1 menu.c32 menu module
Vesamenu.c32-one of the menu modules
The boot menu described above in this article is generated using vesamenu.c32.
Menu.c32-one of the menu modules
After installing the syslinux command package, both menu modules will be generated in the directory / usr/share/syslinux/. When you use menu.c32 to create a boot menu, you only need to copy the menu module menu.c32, kernel files and boot files to the TFTP root directory / var/lib/tftpboot.
[root@pxe1 tftpboot] # ls / var/lib/tftpboot/initrd.img menu.c32 pxelinux.0 pxelinux.cfg vmlinuz
The contents of the menu file are:
[root@pxe1 tftpboot] # cat / var/lib/tftpboot/pxelinux.cfg/defaultdefault menu.c32 timeout 60 menu title CentOS 7 Pxe Menu label linux menu label ^ Install CentOS Linux 7 by kickstart menu default kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.ks= ftp://192.168.56.14/ks.cfglabel linux 2 menu label ^ Install CentOS Linux 7 by vnc kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.vnc inst.vncpassword=passwordlabel linux 3 Menu label ^ Install CentOS Linux 7 by vnc-listen kernel vmlinuz append initrd=initrd.img inst.repo= ftp://192.168.56.14/pub inst.vnc inst.vncconnect=192.168.56.1
The menu display style is:
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.