How to install and configure the network startup server in centos

Source: Internet
Author: User

How to install and configure the network startup server in centos

Background:

When installing servers on a large scale, you need to install servers in batches to reduce the daily workload. However, the basis of automatic Server Installation in batches is the network startup server (bootserver ), the following describes how to install and configure the network startup server for your reference!

The operating system earlier than centos 7 was unable to connect to the TFTP server when PXE was installed due to problems with xinetd and TFTP versions (the version was too low, we recommend that you install TFTP4.0 or later to complete this experiment.

Centos7 and later versions can complete this experiment. The configuration environment of Centos7 and later versions is different from that of previous versions. For more information, see the blog.

Glossary:

PXE :( Pre-boot ExecutionEnvironment) is based on the Intel protocol. It can be started by a computer over a network rather than a local hard drive, optical drive, and other devices. Modern NICs are usually embedded with rom chips that support pxe. During computer boot, the BIOS transfers pxe dient to the memory for execution and displays the command menu. After the user selects it, PEXdient downloads the pxe dient from the remote operating system to the local computer for running.

DHCP: (Dynamic Host Control Protocol) Dynamic Host Control Protocol, used to centrally and dynamically assign IP addresses to customers

TFTP: (trivial file transfer protocol), a file transfer protocol with low overhead. The syntax is similar to ftp. Because of its simplicity and efficiency, it is often used for operating systems and Configuration updates on network devices.

PXE Client Api (Architecture)

Note: When the BIOS loads the PXE Client into the memory, it has the capabilities of DHCP Client and TFTP Client.

PXE Client is capable of DHCP Client and can obtain IP addresses through DHCP Server.

PXE Client is capable of TFTP Client. You can use TFTP to download files such as kernel image.

PXE boot flowchart (pxe boot)

The startup process is described as follows:

1. the PXE Client broadcasts the DHCPDDISCOVER message to the UDP port 67.

2. After receiving the broadcast message, the dhcp server or DHCP Proxy sends the DHCPOFFER (including the IP address) message to port 68 of the PXE Client.

3. the PXE Client sends the DHCPREQUEST message to the dhcp server to obtain the boot file name ).

4. the dhcp server sends the DHCPACK (including the Network Bootstrap Program file name) message to the PXE Client.

5. the PXE Client obtains the NBP (Network Bootstrap Program) file from the Boot Server.

6. the PXE Client downloads NBP from the tftp server, and then runs the NBP file on the Client.

Note: After NBP executes initialization, NBP downloads other required configuration files from the tftp server by default.

At this time, the PXE startup process has been completed, and the rest of the work is completed with NBP.

For example, pxelinux.0 (NBP) downloads the default configuration file to display the menu and starts different kernel images as needed.

If it is the NBP of RIS (Windows installation), Windows boot loader is started to execute the widows installation and deployment task.

Disable selinux and configure iptables rules before installation.

1. pxe boot Server configuration process

[Root @ node1 ~] # Yum install tfpt tftp-server dhcp vsftpd syslinux # install the required software package

[Root @ node1 ~] # Mkdir/var/ftp/pub/centos-6.5-x86_64-pv

[Root @ node1 ~] # Mount-r/dev/cdrom/var/ftp/pub/centos-6.5x86_64/

[Root @ node1 centos-6.5-x86_64] # ls

CentOS_BuildTag isolinux RPM-GPG-KEY-CentOS-Debug-6

EFI Packages RPM-GPG-KEY-CentOS-Security-6

EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6

GPL repodata TRANS. TBL

Images RPM-GPG-KEY-CentOS-6

2. Configure the DHCP service:

During the PXE boot process, the PXE Client obtains the IP address and NBP file name through the DHCP Server, then downloads the NBP file from the tftp server and runs it on the Client to start the computer.

[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 "magedu.com ";

Option domain-name-servers192.168.1.10;

Default-lease-time43200;

Max-lease-time86200;

# No service will be given onthissubnet, but declaring it helps

# DHCP server to understand the network topology.

# Customizing a subnet

Subnet192.168.1.0netmask1_255.255.0 {

Range192.168.1.11 192.168.1.100;

Option routers192.168.1.10;

Next-server192.168.1.10; # the IP address of the TFTP Server

Filename = "pxelinux.0"; # bootstrap file (NBP)

}

Note: In the/etc/dhcpd. conf configuration file, filename "pxelinux.0"; the file directory is the root directory relative to tftp (tftpboot by default ),

Therefore, the relative path of the file is tftpboot/pxelinux.0 ". You can also specify it as another path.

Restart the dhcpd Service

[Root @ node1 ~] # Service dhcpd restart

Shutting down dhcpd: [OK]

Starting dhcpd: [OK]

[Root @ node1 ~] # Ss-uanlp | grep dhcpd

UNCONN00 *: 67 *: * users :( ("dhcpd", 4883,7 ))

3. Configure the tftp Server

[Root @ node1 xinetd. d] # chkconfig tftp on

[Root @ node1 xinetd. d] # service xinetd restart

Stopping xinetd: [FAILED]

Starting xinetd: [OK]

[Root @ node1 xinetd. d] # service xinetd restart

Stopping xinetd: [OK]

Starting xinetd: [OK]

[Root @ node1 ~] # Ss-uanlp | grep xinetd

UNCONN00 *: 69 *: * users :( ("xinetd", 5007,5 ))

UNCONN00 *: 69 *: * users :( ("xinetd ))

Prepare the boot file:

[Root @ node1 ~] # Cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

[Root @ node1 ~] # Cp/var/ftp/pub/centos-6.5-x86_64/isolinux/{boot.msg,splash.jpg, vesamenu. c32}/var/lib/tftpboot/

[Root @ node1 ~] # Ls/var/lib/tftpboot/

Boot. msg pxelinux.0splash.jpg vesamenu. c32

[Root @ node1 ~] # Cp/var/ftp/pub/centos-7-x86_64/images/pxeboot/{vmlinuz, initrd. img}/var/lib/tftpboot/

[Root @ node1 ~] # Ls/var/lib/tftpboot/

Boot. msg initrd. img pxelinux?splash.jpg vesamenu. c32 vmlinuz

[Root @ node1 tftpboot] # mkdir pxelinux. cfg

[Root @ node1 tftpboot] # cd pxelinux. cfg/

[Root @ node1 pxelinux. cfg] # cp/var/ftp/pub/centos-6.5-x86_64/isolinux. defaults default

[Root @ node1 pxelinux. cfg] # chmod + wdefault

[Root @ node1 pxelinux. cfg] # mkdir/var/ftp/pub/kickstart/

[Root @ node1 pxelinux. cfg] # vimdefault

Menu background splash.jpg

Menu title Welcome to CentOS 6.5 from PXE!

Labellinux

Menulabel ^ Install or upgrade an existing system

Menudefault

Kernel vmlinuz

Append initrd = initrd. img ks = ftp: // 192.168.1.10/pub/kickstart/centos6.cfg # The path here is the relative path

4. Install kickstart and configure the cfg file

[Root @ node1 ~] # Yum-y install system-config-kickstart

[Root @ node1 ~] # System-config-kickstart



After all the settings are complete, save the file to the specified directory named/var/lib/tftpboot/pxelinux. in cfg/default, the ks path is the same, and the name is centos6.5.cfg. Add partition information. In the preceding steps, sometimes no installation package exists when you select the software, be sure to download and decompress the image file of the operating system in advance. In addition, you can manually configure the file after the cfg file is generated. However, it is best to configure the image when partitioning the disk, manual configuration may cause some problems, resulting in installation failure. Note that the FTP server should be configured to allow anonymous logon. If you have an account and password, add it during the above configuration. The following shows your cfg file:

# Platform = x86, AMD64, or Intel EM64T
# Version = DEVEL
# Firewall configuration
Firewall -- disabled
# Install OS instead of upgrade
Install
# Use network installation
Url -- url = "http: // 192.168.1.10/pub/centos-6.5-x86_64"
# Root password
Rootpw -- iscrypted $1 $ Lk5nHdlh $ oRSE67690ang4GObxj9dm0
# System authorization information
Auth -- useshadow -- passalgo = sha512
# Use graphical install
Graphical
Firstboot -- disable
# System keyboard
Keyboard us
# System language
Lang zh_CN
# SELinux configuration
Selinux -- enforcing
# Installation logging level
Logging -- level = info
# Reboot after installation
Reboot
# System timezone
Timezone Asia/Shanghai
# System bootloader configuration
Bootloader -- location = mbr
# Partition clearing information
Clearpart -- all

% Packages
@ Basic-desktop
@ Chinese-support
@ Debugging
@ Desktop-platform
@ Guest-agents
@ Ha
@ Ha-management
@ Input-methods
@ Legacy-x
@ Load-balancer
@ Mysql
@ Mysql-client
@ Network-server
@ Network-tools
@ Nfs-file-server
@ Remote-desktop-clients
@ Resilient-storage
@ Storage-server
@ Virtualization
@ Virtualization-client
@ Virtualization-platform
@ Virtualization-tools
@ X11

% End

[Root @ node1 ~] # Service vsftpd start

After the configuration of the entire server is complete, you can start the client for installation.

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.