Server Setup Environment:
SERVER1:ETH0:192.168.10.10/24 RHEL 5.8
First, install the necessary packages
mount/dev/hdc/mnt/iso/
Yum-y install vsftpd tftp tftp-server syslinux DHCP
Second, configure the DHCP server, note 1
Echo ' Ddns-update-style interim;
Ignore client-updates;
Allow booting;
Allow BOOTP;
Subnet 192.168.10.0 netmask 255.255.255.0 {
Option routers 192.168.10.1;
Option Subnet-mask 255.255.255.0;
Option Domain-name-servers 8.8.8.8;
Option time-offset-18000; # Eastern Standard Time
Range DYNAMIC-BOOTP 192.168.10.128 192.168.10.254;
Default-lease-time 21600;
Max-lease-time 43200;
Next-server 192.168.10.10;
FileName "/pxelinux.0";
} ' >/etc/dhcpd.conf
Service DHCPD Start
NOTE 2
Third, configure the TFTP server
Sed-i '/disable/s/=.*/= no/'/etc/xinetd.d/tftp
Service xinetd Start
Service VSFTPD Start
Iv. copying and editing PXE boot files (located in the TFTP server directory)
cp/usr/lib/syslinux/pxelinux.0/tftpboot/
echo '--to boot from local, type local
--to Install RHEL 5.8, type rhel5
' >/tftpboot/boot.msg
Cp/mnt/iso/images/pxeboot/initrd.img/tftpboot/initrd_rhel5_x86.img
Cp/mnt/iso/images/pxeboot/vmlinuz/tftpboot/vmlinuz_rhel5_x86
Mkdir/tftpboot/pxelinux.cfg
Echo ' Default local
Display Boot.msg
Prompt 1
Timeout 30
Label Local
localhost 0
Label Rhel5
Kernel vmlinuz_rhel5_x86
Append initrd=initrd_rhel5_x86.img devfs=nomount ramdisk=9216 text ks=ftp://192.168.10.10/pxe/rhel5.8/ks.cfg Ksdecive=eth0 ' >/tftpboot/pxelinux.cfg/default
V. Copy and edit the PXE installation source (located in the VSFTP server directory)
Mkdir-p/var/ftp/pxe/rhel5.8
cp-rf/mnt/iso/*/var/ftp/pxe/rhel5.8/
Echo ' # Kickstart file automatically generated by Anaconda.
Install
URL--url ftp://anonymous:@192.168.10.10/pxe/rhel5.8
Key--skip
Lang Zh_cn. UTF-8
Keyboard US
Text
Network--device eth0--onboot Yes--bootproto DHCP--hostname client.vicp.net
ROOTPW--iscrypted $1$sgfg3x5a$hozcgkungiqlevd1wan.e1
Firewall--disabled
Authconfig--enableshadow--ENABLEMD5
SELinux--disabled
TimeZone--UTC Asia/shanghai
Bootloader--LOCATION=MBR--DRIVEORDER=SDA
# The following is the partition information you requested
# Note that any partitions deleted is not expressed
# unless you clear all partitions first
# Guaranteed to work
Clearpart--linux
Part/boot--fstype ext3--size=100
#part Swap--size=512
Part/--fstype ext3--size=6005
Reboot
%packages
@british-support
@chinese-support
@core
Sgpio ' >/var/ftp/pxe/rhel5.8/ks.cfg
Note 3
Complete
Starting a new host in the same network segment, you can automatically complete the installation of the system as long as you enter Rhel5. If the hard drive is not initialized, the system prompts you to press a carriage return.
Root has an initial password of 123456
Note 1:
This example is tested on a virtual machine, and in a production environment I also debug the machine and then access the network.
If you encounter Windows and Linux coexistence environment in the production environment, the Windows domain must have its own DHCP server, it is possible to conflict with the DHCP of Linux (whether there is any impact, what impact, I have not tried, nor dare to try), Therefore, the author recommends that the PXE server be placed in the debugging environment to avoid affecting the network of the production environment.
NOTE 2:
The following few of the DHCP server configuration files are key:
Allow booting;
Allow BOOTP;
Next-server 192.168.10.10; #指定tftp服务器
FileName "/pxelinux.0"; #指定启动文件名, although it starts with a/, but is actually a relative path, which means "/tftpboot/pxelinux.0"
Note 3:
How did the contents of the/var/ftp/pxe/rhel5.8/ks.cfg file come from? How do I edit it?
This file is manually installed after the system in the root directory of the Anaconda-ks.cfg file copied to make simple changes.
To modify what, the reader can compare with my example to understand. The file contains the root of the initial password (my initial password is 123456), remember to change the password after installation!
Linux PXE Auto-deploy operating system