Fully Automatic Installation of Linux operating system (centos) 11:15:39
Tags: Linux
PXE
Centos
Automatic
Original casual works are allowed to be reprinted. During reprinting, please mark the article in hyperlink form
Original source, author information, and this statement. Otherwise, legal liability will be held. Http://shubao.blog.51cto.com/401810/612987
The client Nic starts the DHCP process through the PXE chip embedded in the NIC to obtain the IP address from the server during host startup initialization. After the NIC obtains the IP address, the server will provide the client with a command to download the bootloader, is the DHCPD In the DHCP server. the filename option in the conf configuration file.
I. process logic: (skip the text and follow the installation steps to see how it works)1: when the host starts initialization, the client Nic starts the DHCP process through the PXE chip embedded in the NIC to obtain the IP address from the server. After the NIC obtains the IP address, the server will provide the client with a command to download the bootloader, is the DHCPD In the DHCP server. the filename option in the conf configuration file. 2: The PXE chip of the NIC already contains the TFTP client program. After obtaining the IP address, the NIC will start the TFTP service to send the request to the TFTP server to transfer the bootloader file pxelinux.0. After the bootloader is loaded, we can see information on the host screen, which is the first screen we saw when installing Linux with an optical drive. The screen prompts you to select graphical interface installation or Linux text character interface installation and other information. If only this file is in the tftpboot directory on the server end, the customer will stay in the boot directory because the bootloader configuration file does not have default to tell the machine which system kernel to load next, the default configuration file is used to tell the host where to load the operating system kernel. At this time, if we follow the normal CD installation instructions, we will see the prompt: Enter the carriage return or Linux
Text and other information. Bootloader calls the operating system kernel file in the default configuration file. 3: After the default file is configured, specify the kernel file, which is at the end of the default file. It is the vmlinuz, initrd. IMG *. MSG files. 4: After this step is loaded successfully, the system will see the same process as we normally see in the CD installation system. Select the language, mouse, keyboard, and so on, however, because of the Automatic Installation step of KS, we do not need to manually specify these, all will be automatically completed. 5: So far, someone may ask where to load the installed image. Not long. Isn't there a KS installation script? In this script, we can specify where to install the image. 6: now we will consider the transmission of system images. Here we use the Linux-specific NFS Network File System for image transmission. Of course, you can also use HTTP, FTP, and other methods. But why do we directly use TFTP, because this protocol is very inefficient in transferring large files.
Ii. Installation Process: Description: Server IP: 192.168.9.20 Linux: centos 5.2
1: Install the TFTP server and DHCP server:Root @ centos] # rpm-Qa | grep TFTP tftp-server-0.42-3.1.el5.centos [root @ centos] # rpm-Qa | grep DHCP dhcpv6-client-1.0.10-4.el5 dhcp-3.0.5-13.el5 to ensure that the client can get the IP address and pxelinux.0 File.
2. Modify the TFTP parameters:[Root @ centos] # vi/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 = Yes/change to no/per_source = 11 CPS = 100 2 flags = IPv4 }............................................. ......................................................... /Tftpboot: Specifies the directory on which the TFTP client loads the bootloader pxelinux.0 file from the server.
3: Start TFTP:[Root @ centos] # service xinetd restart stopping xinetd: [failed] Starting xinetd: [OK]
4: Install the DHCPD service and configure the startup:[Root @ centos ~] # Vi/etc/DHCPD. conf ddns-Update-style
Interim; ignore client-updates; boot BOOTP; subnet 192.168.9.0 netmask 255.255.255.0 {/IP address assigned to the client/option routers 192.168.9.1; Option subnet-mask 255.255.255.0; Option domain-name "domain.org "; option domain-name-servers 202.96.128.66; Option time-offset
-18000; range dynamic-BOOTP 192.168.99.2 192.168.9.100; FILENAME "/pxelinux.0";/the boot file used to specify the tftp root directory is actually in the/tftpboot directory. /Default-lease-time 21600; max-lease-time 43200; next-server 192.168.9.20;
/This statement tells the client where to load bootloade/R}
5: Create a folder and copy pxelinux.0 to the/tftpboot directory:Mkdir/tftpboot CP/usr/lib/syslinux/pxelinux.0/tftpboot/pxelinux.0server already has/midir/tftpboot/pxelinux. CFG touch/tftpboot/pxelinux. the content of CFG/default can be modified as follows :.................................................................................... Default autoinstall/default guide autoinstall label/prompt 1 timeout 30/default automatic loading time 30 s /.................................... Label autoinstall kernel vmlinuz
/Kernel file name/append Ks = NFS: 192.168.9.20:/tftpboot/KS initrd = initrd. IMG devfs = nomount ramdisk_size = 16384 nofb ................................................................................................ The append option specifies where to read the configuration file and how to load it. Here, we use NFS to obtain the KS file. Of course, we can also use ftp, HTTP, and other methods. KS file, that is, Linux automatically loads various parameters during installation. We usually need to select the appropriate language, Font, keyboard, mouse, partition, and installed software package waiting information when installing with a CD, KS files automate these options.
6. KS file content: You can change it according to your actual environment..................................................................................... Lang en_us langsupport zh_cn en_us -- default = en_us keyboard us mouse timezone Asia/Shanghai rootpw password/newly installed system root password/reboot # Upgrade install # harddrive -- partition = sdb1
-- Dir = RHAs NFS -- Server = 192.168.9.20
-- Dir =/Media/CDROM/Specify the Image Location/Text bootloader -- location = MBR zerombr Yes clearpart -- drives hda-initlabe/Hard Disk name, change/part/-- fstype ext3 -- size 3072 -- asprimary -- ondisk had part swap -- size 256 -- asprimary -- ondisk hda part/tmp -- fstype ext2 -- size 256 -- ondisk hda according to the actual environment part/home -- fstype ext3 -- size 1 -- grow -- ondisk hda auth -- useshadow -- enablemd5 # Network -- bootproto = DHCP
-- Device = eth0 Network -- device = eth0 -- bootproto = static -- IP = 192.168.9.210 -- netmask = 255.255.255.0
-- Gateway = 192.168.9.244
-- Nameserver = 202.96.128.68 -- hostname = test.com/Specify the Host Name and IP address of the newly installed system/firewall -- disabled skipx % packages-resolvedeps/Specify the package required for the newly installed system/@ development-tools- tools @ system-tools .......................................................................................... For more information about KickStart, see the RedHat official website. Modify the KS content based on the actual environment to suit your requirements.
7. Create an NFS server:A: First confirm that the NFS file system has been installed on the server. [Root @ centos ~] # Rpm-Qa | grep NFS nfs-utils-lib-1.0.8-7.2.z2 nfs-utils-1.0.9-33.el5 B: modifying NFS parameter files [root @ centos ~] # Vi/etc/exports ........................................................................ /Media/CDROM * (RO, sync )........................................................................... This configuration is simple:/Media/CDROM shares the directory on the server, which contains the content of the installation disc. * (RO, sync) * indicates that all users (RO, sync) have read-only permissions and data is synchronized to the hard disk. C: Start the NFS service: root @ centos ~] # Service Portmap start [root @ centos ~] # Service NFS start starting NFS services: [OK] Starting NFS quotas: [OK] Starting NFS daemon:
[OK] Starting NFS mountd: [OK] [root @ centos ~] # Exportfs/confirm that NFS sharing is normal // media/CDROM ............................................................
8: after the client machine is manually powered on, this is the only place where manual power is needed, enjoy the automatic installation of dozens of hundreds of Linux Hosts.
This article from "Shu Bao-Sun Liang" blog, please be sure to keep this source http://shubao.blog.51cto.com/401810/612987