Fedora builds servers, DHCP + tftp + FTP + PXE starts to install centos

Source: Internet
Author: User

 

1. Introduction
PXE is a way to boot a computer without a floppy drive, hard disk, or CD-ROM, that is, BIOS will boot from the network using the PXE protocol.

2. Preparation
One host with fedora or centos installed (I use a host with fedora 14 i686 as an example)
CentOS-5.5-i386-bin-DVD.iso (prepare a system DVD image, I'll take this as an example)
Prepare the client to install the system (to support starting from the NIC)
Connect the network cable to the LAN

The next step is to install the server required for configuration in the ora14 host.

3. Configure DHCPD
DHCP server
Run the following command to check whether DHCP is installed:
Rpm-Q DHCP

If not, run the following command:
Yum install DHCP

Copy the default configuration file to the/etc/DHCP/directory and rename it:
CP/usr/share/doc/DHCP */DHCPD. conf. Sample/etc/DHCP/DHCPD. conf

# Note: if you are using another version, the configuration file may be/etc/DHCPD. conf ####

Note:
In this article, ### and the following text are self-added remarks. Do not write them into the configuration file.

Modify configuration file
Add the following section in the last line of the configuration file. modify it as needed.

Subnet 192.168.0.0 netmask 255.255.255.0 {
Range 192.168.0.90 192.168.0.96;
Option routers 192.168.0.254;
Option subnet-mask limit 255.0;
Option domain-name "domain.org ";
Option domain-name-servers 202.96.128.86, 202.96.128.166;
Next-server 192.168.0.22;
Filename "pxelinux.0 ";
}

========================================================== ==================
Subnet 192.168.0.0 netmask 255.255.255.0 {
### IP address segment and subnet mask of the DHCP server itself, the IP address segment of the NIC static IP Address

Range 192.168.0.90 192.168.0.96;
### IP address range assigned to the client

Option routers 192.168.0.254;
### Route gateway allocated to the client

Option subnet-mask limit 255.0;
### Subnet mask assigned to the client

Option domain-name "domain.org ";
#### Specify the DNS name for the client.

Option domain-name-servers 202.96.128.86, 202.96.128.166;
### Specify the IP address of the DNS server for the client. Separate multiple DNS addresses with commas (,).

Next-server 192.168.0.22;
### IP address of the TFTP server used for network installation

Filename "pxelinux.0 ";
### PXE Startup File used for network installation. This file is provided by syslinux

#### Do not forget the semicolon (;) and the ending bracket next to each line !!!!

========================================================== ======

Disable other DHCP servers in the LAN to avoid IP conflict.

Start the DHCP server
Service DHCPD start or/etc/rc. d/init. d/DHCPD start

Chkconfig DHCPD on #### enable DHCP automatically upon startup

4. Configure TFTP
TFTP Server
Run the following command to check whether TFTP is installed.
# Rpm-q tftp-Server

If not, run the following command to install
Yum install TFTP-Server

Modify configuration file
VI/etc/xinetd. d/TFTP

Server_args =-S/var/lib/tftpboot #### this is the default directory of TFTP.
Modify it
Erver_args =-S/tftpboot

Create the/tftpboot directory
Mkdir-V/tftpboot

Start TFTP
Service xinetd start
Chkconfig TFTP on #### set to boot

5. PXE Boot Loader (PXE Boot Loader)
Pxelinux.0 is provided by syslinux. Run the following command to check whether the system has been installed and stored in the directory. If not, install
Rpm-QL syslinux | grep pxelinux.0

Pxelinux.0 is stored in
/Usr/share/syslinux/pxelinux.0

Copy pxelinux.0 to/tftpboot
CP-V/usr/share/syslinux/pxelinux.0/tftpboot

6. Extract the required files.
Copy initrd. IMG vmlinuz in the CentOS-5.5-i386-bin-DVD.iso/images/pxeboot directory to the/tftpboot directory.

Create a directory for storing PXE boot settings files
Mkdir-PV/tftpboot/pxelinux. cfg

Copy the CentOS-5.5-i386-bin-DVD.iso/isolinux. cfg file to the/tftpboot/pxelinux. cfg directory and rename it to default
The content is as follows. Each lable is a startup option. Enter the words following the lable and press enter to start the corresponding options. You can modify the settings as needed.
If no input is made within the specified time, the default item is automatically started.

========================================================== ==============

Default Linux ### default startup Item, that is, the label Linux Section
Prompt 1 ### enable prompt information
Timeout 600 ### which item to select is not input in the default time, the default item above will be automatically started
Display boot. MSG ### boot option information. The Boot. MSG file contains some instructions.
F1 boot. MSG ### press the corresponding buttons to view the instructions, provided that these files are in the folder.
F2 options. MSG ### in fact, these files are in the CentOS-5.5-i386-bin-DVD.iso/isolinux/
F3 General. msg
F4 Param. msg
F5 rescue. msg
Label Linux #### this is the first startup option for graphical interface Installation
Kernel vmlinuz
Append initrd = initrd. img
Label text ### this is the text interface installation mode
Kernel vmlinuz
Append initrd = initrd. IMG text
Label KS ### use Kickstart to install
Kernel vmlinuz
Append KS initrd = initrd. img
Label local ### start from local hard disk
Localboot 1
Label memtest86 ### memory test options
Kernel memtest
Append-
========================================================== ==========

Note:
In this article, ### and the following text are remarks. Do not write the configuration file.

========================================================== ==========

Copy the system CentOS-5.5-i386-bin-DVD.iso/isolinux/boot. MSG file to the/tftpboot directory.
The file content is as follows. It is only the boot information and can be modified based on the root certificate.
This is a description of the setting options of/tftpboot/pxelinux. cfg/default.

========================================================== ==========

Nstallation menu
Choose installation type:
0 local boot (default)
1 rhel5.1 Base System
2 rhel5.1 Workstation

========================================================== ========
Here, we can start the client to install the system, enter the bios, and enable the NIC,
Then, set the first boot item to the NIC to see if you can get the IP address and start the installer. If you can, it will be far from success.

7. Install the FTP server. (You can also use NFS or HTTP instead)
Run the following command to check whether the FTP server is installed:
Rpm-Q vsftpd

If not, run the following command.
Yum install vsftpd

Start FTP
Service vsftpd start or/etc/rc. d/init. d/vsftpd start

The configuration process is not described because you can log on anonymously after the installed vsftpd is started.
The configuration file will only appear after startup. The configuration file is in:/etc/rc. d/init. d/vsftpd
After the startup, test whether you can log on. Use a browser or FTP software to log on.
If not, modify the configuration file.

##### Note: After the configuration file is saved, it takes effect only after the corresponding service is restarted. #########

8. Mount ISO directly to the FTP directory.
Mount-o loop ISO/var/FTP/pub

In addition to the above method, you can mount the system ISO to be installed, and then copy all the files in the image to the default FTP directory/var/FTP/pub/
For example, Mount ISO to/mnt/DVD.
Mkdir-PV/mnt/DVD
Mount-o loop ISO/mnt/DVD
CP-r/mnt/DVD/*/var/FTP/pub

9. To ensure that all servers are started, run the following command to restart all servers.
Service DHCPD restart
Service xinetd restart
Service vsftpd restart

10. Start the installation.
Open the client, set the first startup Item to Nic, and start the installation.

Enter the startup interface and press enter to start the default item.
Select language, keyboard layout, and install Media
Select FTP as the installation Medium
Then, set the network card and select Automatic Retrieval (DHCP)
Enter the IP address of the FTP server.
192.168.0.22 ### enter the ftp ip address of your host
/Pub
Then select OK
If you cannot log on anonymously, select the line below and enter the FTP account and password.

After the boot is successful, it will be no different from the installation on the CD. I will not introduce it here.

Because it is not the same version, the RedHat kickstart cannot be used for automatic installation.
However, in this method, you can start and install the centos DVD and the openora DVD opensuse DVD.

Collect and organize the Linux learning network. (If you think this site is good, please tell your friends or repost it to the Forum, Baidu know, post it, etc. Remember to include the website address. Thank you !).

 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.