1. solution introduction
In this solution, you must first set a startup server and an installation server (which can be configured on the same physical machine), and then start the installation program stored on the startup server through the network. The installer automatically accesses the installation configuration file and media stored on the Installation server to complete the installation.
Technologies involved
This solution mainly applies three technologies:
1) Start the PXE protocol of the Red Hat Linux installer from the network on the PC.
2) network installation function provided by Red Hat Linux Installer (that is, access the installation media through the network)
3) unattended installation feature provided by Red Hat Linux Installer (Red Hat is called kickstart)
Technology 1) and 2) some introductions are available in References 1 and 2. This article will focus on the reference materials that do not involve partial and unattended installation functions.
Hardware and software requirements
To perform automatic installation as described in this article, you need the following hardware and software resources:
One PC machine is used as the startup and Installation server (Other architecture machines can also be used)
The network card of a PC to be installed must have PXE support
The above two machines have been connected to the same subnet.
Red Hat Linux installation media to be installed
Steps for implementing this solution
1) configure the startup Server
2) configure and install the server
3) start the machine from the network to complete installation
Steps 1) and 2) only need to be done once. For each machine that needs to install Red Hat Linux, You need to deploy the corresponding data on the startup server and the Installation server, and perform step 3 ).
The following describes how to perform these steps one by one. For simplicity, I will use an example to illustrate how to set up the startup server and the Installation server on a PC with Red Hat Enterprise Linux AS 3 Update 5 installed, install Red Hat Enterprise Linux AS 4 Update 2 on a PC.
2. Step 1: configure the startup Server
The purpose of starting the server is to help start the Red Hat Linux installer on the machine to be installed. A DHCP server and a TFTP server must be set up to start the server. The former is to assign an IP address to the machine to be installed, and the latter provides a way for the machine to download the boot image.
Configure DHCP server
1) install the DHCP server package (RPM package name: dhcpd ).
2) edit the DHCP server configuration file/etc/dhcp. conf. Here is an example:
option domain-name "mydomain";ddns-update-style none; max-lease-time 7200;server-name "bootserver";default-lease-time 600; allow booting;allow bootp; subnet 192.168.138.0 netmask 255.255.255.0 { range 192.168.138.1 192.168.138.254; deny unknown-clients;} group pxe { filename "pxelinux.0"; host testserver { hardware ethernet 00:0C:29:70:24:5B; fixed-address 192.168.138.30; }}
|
In this example, the defined subnet is 192.168.138.0/255.255.255.0. The host definition item testserver indicates that the IP address 192.168.138.30 will be allocated to the ethernet card 00: 0C: 29: 70: 24: 5B (the machine to be installed ), the pxelinux.0 file (in the root directory of the TFTP server) will be loaded into the memory and run as the boot image by the PXE client in the nic rom.
Add a host entry in dhcpd. conf for each machine to be installed.
3) configure an IP address for the startup server, which must be in the subnet defined by the DHCP server.
Here we use 192.168.138.1. For details about how to configure IP addresses for Red Hat Linux systems, refer to reference 3.
4) Start the DHCP service.
[Root @ bsvr] # service dhcpd restart
Configure the TFTP Server
1) install the TFTP server package (RPM package name: tftpd ).
2) edit the configuration file/etc/xinetd. d/TFTP of the tftp server. The configuration file is as follows:
service tftp{ socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot disable = no}
|
Here,/tftpboot is selected as the root directory of the TFTP server.
3) copy the Linux Installer's kernel/root file system file to the root directory of the TFTP server. This operation is required for each Red Hat Linux version to be installed.
The first installation CD in Red Hat Linux/isolinux directory contains the kernel/root file system file of the Linux installation program. The following command copies these files to the root directory of the TFTP server and renames them by version.
[Root @ bsvr] # mkdir/mnt/iso
[Root @ bsvr] # mount-o loop, ro RHEL4-U2-i386-AS-disc1.iso/mnt/iso
[Root @ bsvr] # cp/mnt/iso/isolinux/initrd. img/tftpboot
[Root @ bsvr] # cp/mnt/iso/isolinux/vmlinuz/tftpboot
[Root @ bsvr] # mv/tftpboot/initrd. img/tftpboot/initrd-rhel4u2-i386.img
[Root @ bsvr] # mv/tftpboot/vmlinuz/tftpboot/vmlinuz-rhel4u2-i386
4) copy the Boot Image File pxelinux.0 to the root directory of the TFTP server.
You can obtain the Boot Image pxelinux.0 in the syslinux installation package. After installing the syslinux installation package, copy pxelinux.0 to the root directory of the TFTP server.
[Root @ bsvr] # cp/usr/lib/syslinux/pxelinux.0/tftpboot/
5) edit the configuration file of pxelinux.0 so that pxelinux can correctly load the Red Hat Linux installer. This operation is required for each Red Hat Linux version to be installed.
When the image pxelinux.0 file is started, the configuration file is read to determine which Linux kernel file should be loaded for running. All configuration files are stored in the/tftpboot/pxelinux. cfg/directory of the startup server. Pxelinux.0 searches for appropriate configuration file names based on certain rules. For example, for the IP address 192.168.138.30 (in hexadecimal format, C0A88A1E) previously assigned to the machine to be installed, pxelinux.0 searches for the configuration file in the following order:
C0A88A1E> C0A88A1>... > C0> C> default
That is to say, if the C0A88A1E file exists, it is the configuration file that pxelinux.0 will load. Otherwise, continue searching. If the C0A88A1 file exists, it is the configuration file that pxelinux.0 will load. If no file starting with C exists, pxelinux.0 tries to read the configuration from the default file. For an installation server that supports many machines, it is not flexible to write the configuration in the file corresponding to the IP address. It is a good idea to centralize all configurations in the default file, which can reduce the maintenance burden on the configuration file.
You can write all the configurations of Red Hat Linux in the default file to support multiple Red Hat Linux versions at the same time, as shown below (for a specific Red Hat Linux version, for how to write the corresponding lines, refer to the configuration file/isolinux in the installation disk. cfg ):
DEFAULT rhel4u2-i386DISPLAY pxelinux.cfg/listP
|