|
About PXE
pxe working in network mode Client / Server, the client in the case where there is no local operating system, it is possible to download files from the server to the mirror and kickstart files over the network, and based kickstart files to automate system installation. When the deployment environment for multiple servers, batch install the operating system in this way, greatly reducing the workload.
PXE dependent services:
1) dhcp: client dynamically assigned IP address, subnet mask, gateway, DNS address and other network properties;
2) tftp: provides the client installation required boot loader, kernel, ramdisk and other documents;
3) http: kickstart file and provide the installation source.
PXE works: the client startup process, if there is no local program guide, and finally through the card as a boot device, then activates pxe feature on the card, pxe_client program is transferred to the memory is performed, broadcast request DHCP address , LAN DHCP server responds, the configuration for various network attributes assigned address, subnet mask and gateway. Core client to download pxelinux.0 file from the specified tftp server according to the instructions of the DHCP server (pxe start document, similar bootloader), the download is complete loaded for execution, and then in the request to the server when using pxe boot, ramdisk, anaconda procedures to start the installation process.
On the card are generally integrated dhcp and tftp client program.
Deployment Process
Deployment dhcp server
[Root @ node1 ~] # yum install dhcp
[Root @ node1 ~] # cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[Root @ node1 ~] # vim /etc/dhcp/dhcpd.conf
option domain-name "baby.org"; # Domain Search List
option domain-name-servers 114.114.114.114; # domain name server address
default-lease-time 600; # default lease duration (in seconds)
max-lease-time 7200; # maximum lease duration (in seconds)
log-facility local7; # use rsyslog log storage
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.10 192.168.3.254; # address pool
option routers 192.168.3.1; # gateway
option broadcast-address 192.168.3.31; # broadcast address
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.3.2; # next access server address (tftp)
filename "pxelinux.0"; # on the next-server to download the file
}
Check the configuration information, and then start the service:
[Root @ node1 ~] # service dhcpd configtest
Syntax: OK
[Root @ node1 ~] # service dhcpd start
Starting dhcpd: [OK]
Service has been running.
Tftp server deployment
There xinetd tftp service management services, the installation is complete open the service xinetd, restart the xinetd service.
[Root @ node1 ~] # yum install tftp-server
[Root @ node1 ~] # chkconfig tftp on
[Root @ node1 ~] # vim /etc/xinetd.d/tftp
service tftp
{
disable = no # service has become available
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s / var / lib / tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
server_args specify the parameters of the service starts, -s specify the working directory to / var / lib / tftpboot. The file on the client needs to be placed in the directory.
Start the service:
[Root @ node1 ~] # service xinetd restart
Stopping xinetd: [FAILED]
Starting xinetd: [OK]
Service has been running.
Deployment httpd service
[Root @ node1 ~] # yum install httpd
/ Mnt / flash mount the CD-ROM directory, create a directory under / var / www / html, and bind it to / mnt / flash.
[Root @ node1 ~] # mkdir -pv / var / www / html / CentOS / 6 / x86_64
mkdir: created directory `/ var / www / html / centos'
mkdir: created directory `/ var / www / html / centos / 6 '
mkdir: created directory `/ var / www / html / centos / 6 / x86_64 '
[Root @ node1 ~] # mount --bind / mnt / flash / / var / www / html / centos / 6 / x86_64 /
After the binding, you can through the / var / www / html / centos / 6 / x86_64 / direct access to the / mnt / flash / (Setup source path). Then start the service.
[Root @ node1 ~] # service httpd start
Add the required files to the tftp directory service:
Mount the CD image, copy the necessary files to / var / lib / tftpboot directory under, mount the CD image directory / mnt / flash.
[Root @ node1 ~] # cp /mnt/flash/images/pxeboot/{vmlinuz,initrd.img} / var / lib / tftpboot /
[Root @ node1 ~] # cp /mnt/flash/isolinux/{boot.msg,vesamenu.c32,splash.jpg} / var / lib / tftpboot /
[Root @ node1 ~] # mkdir /var/lib/tftpboot/pxelinux.cfg
[Root @ node1 ~] # cp /mnt/flash/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
It provides PXE work environment (providing pxelinux.0 file):
[Root @ node1 ~] # yum install syslinux
[Root @ node1 ~] # cp /usr/share/syslinux/pxelinux.0 / var / lib / tftpboot /
pxelinux.0 during operation reads vesamenu.c32 to display a graphical interface, splash.jpg as a background image, vesamenu.c32 reads isolinux.cfg File menu to display graphics, isolinux.cfg file must be in the directory pxelinux.cfg By and named default.
Graphical menu defaults to the first item, which corresponds to the configuration file for the default file pxelinux.cfg directory, modify the file to add the first start-up parameters ks, so that when you load the kernel can get kickstart file.
[Root @ node1 ~] # vim /var/lib/tftpboot/pxelinux.cfg/default
..........
..........
label linux
menu label ^ Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd = initrd.img ks = http: //192.168.3.2/ks_file/ks.cfg text
Provided kickstart file
[Root @ node1 ~] # cp /root/anaconda-ks.cfg /var/www/html/ks_file/ks.cfg
[Root @ node1 ~] # chmod + r /var/www/html/ks_file/ks.cfg
You can use the system-config-kickstart to create a kickstart file. The steps are simple to install system-config-kickstart, type system-config-kickstart command starts a graphical interface to configure the parameters of the installation, and then generate the kickstart file (with the installation of the operating system in much the same).
In the / root directory has an anaconda-ks.cfg file, which is the kickstart file, which records the installation of the local operating system parameters and other information. It can be modified and used to use. Following is a partial modification:
[Root @ node1 ~] # vim /var/www/html/ks_file/ks.cfg
text # text interface to install
reboot # reboot automatically after installation
Disable selinux selinux --disabled #
.....
# The following is the disk partition contents
clearpart --all --drives = sda
part / boot --fstype = ext4 --size = 500
part pv.008002 --grow --size = 1
volgroup vg_node1 --pesize = 4096 pv.008002
logvol / home --fstype = ext4 --name = lv_home --vgname = vg_node1 --grow --size = 100
logvol / --fstype = ext4 --name = lv_root --vgname = vg_node1 --grow --size = 1024 --maxsize = 51200
logvol swap --name = lv_swap --vgname = vg_node1 --grow --size = 1984 --maxsize = 1984
url --url = "http://192.168.3.2/centos/6/x86_64"
repo --name = "CentOS" --baseurl = http: //192.168.3.2/centos/6/x86_64 --cost = 100
The above repo parameter specifies the installation source path to point to the CD image path on the httpd server.
Testing is available
Deploy a virtual machine with no operating system on the network segment, and then start. You can also set a virtual machine first boot device for the network card.
Boot screen
Find the installation source
The installation of packages
Complete the test ................ |
|
|
|