How to remotely install Linux

Source: Internet
Author: User
How to remotely install Linux-Linux Enterprise Application-Linux server application information is as follows. How to remotely install Linux

--------------------------------------------------------------------------------


(Transfer)
Generally, we use a soft drive or an optical drive to guide Linux and then install Linux through a local optical drive. However, this installation method is not applicable in the following situations:

No drive and drive: many companies generally do not have a drive or drive on their computers to save costs, so they cannot install Linux locally;
Non-standard ephemeral drive and optical drive: although the optical drive is configured in the notebook, it is not always a standard IDE device, some are through the USB interface, and some are through the 1394 Interface (such as Samsung Q10 ). Linux kernels boot during Linux installation generally do not have drivers with these interfaces, so Linux cannot be installed locally;
In addition, in some cases, for example, a large number of computers in the data room need to install Linux at the same time. If you install Linux one by one through the optical drive, it is not only inefficient, but also not conducive to maintenance.
I encountered the second situation during my work. Redhat Linux 8.0 needs to be installed in a Samsung Q10 notebook. However, after the boot via the optical drive, the installer cannot access the CD. To solve this problem, I found out how to install Linux on Q10 after reading the materials and exploring. In the following discussion, if we do not make a special statement, we will take Q10 as an example to introduce how to remotely install Linux Through PXE Bootrom.

2. Basic Principles

1) What is PXE?

PXE (Pre-boot Execution Environment) is a protocol designed by Intel that enables computers to start over the network. The Protocol is divided into two ends: client and server. The PXE client is in the ROM of the NIC. When the computer boots, the BIOS transfers the PXE client to the memory for execution and displays the command menu. After the user selects the client, the PXE client downloads the operating system on the remote end to the local computer for running.

To successfully run the PXE protocol, you must solve the following two problems:

Since it is transmitted through the network, who will configure the IP address of the computer when it is started;
What protocol does it use to download the Linux kernel and the root file system?
The first problem can be solved through the DHCP Server. The DHCP server assigns an IP address to the PXE client. The DHCP Server is a protocol used to dynamically allocate IP addresses to the DHCP Client, however, because the IP address is assigned to the PXE Client, you need to add a specific PXE configuration When configuring the DHCP Server.

As for the second problem, TFTP client already exists in the ROM where the PXE Client is located. PXE Client uses the TFTP Client to download the required files to the TFTP Server through the TFTP protocol.

In this way, the conditions for running the PXE protocol are met. Let's take a look at the working process of the PXE protocol.

2) Work Process





In, PXE client is a computer that requires Linux installation. TFTP Server and DHCP Server run on another Linux Server. The Bootstrap file, configuration file, Linux kernel, and Linux root file system are all stored in the root directory of the TFTP Server on Linux Server.

The PXE client requires three binary files: bootstrap, Linux kernel, and Linux root file system. The Bootstrap file is an executable program that provides you with a simple control interface and downloads the appropriate Linux kernel and Linux root file system based on your selections.

3. Steps

With the previous background knowledge, you can perform the following operations:

1) configure the DHCP Server

Select ISC dhcp-3.0, DHCP Server configuration file is/etc/dhcpd. conf, the configuration file content is as follows:


Option space PXE;
Option PXE. mtftp-ip code 1 = ip-address;
Option PXE. mtftp-cport code 2 = unsigned integer 16;
Option PXE. mtftp-sport code 3 = unsigned integer 16;
Option PXE. mtftp-tmout code 4 = unsigned integer 8;
Option PXE. mtftp-delay code 5 = unsigned integer 8;
Option PXE. discovery-control code 6 = unsigned integer 8;
Option PXE. discovery-mcast-addr code 7 = ip-address;

Class "pxeclients "{
Match if substring (option vendor-class-identifier, 0, 9) = "PXEClient ";
Option vendor-class-identifier "PXEClient ";
Vendor-option-space PXE;

# At least one of the vendor-specific PXE options must be set in
# Order for the client boot ROMs to realize that we are a PXE-compliant
# Server. We set the mcast ip address to 0.0.0.0 to tell the boot ROM
# That we can't provide multicast TFTP (address 0.0.0.0 means no
# Address ).

Option PXE. mtftp-ip 0.0.0.0;

# This is the name of the file the boot ROMs shocould download.
Filename "pxelinux.0 ";

# This is the name of the server they shocould get it from.
Next-server 192.168.0.1;
}
Ddns-update-style interim;
Ignore client-updates;
Default-lease-time 1200;
Max-lease-time 9200;
Option subnet-mask limit 255.0;
Option broadcast-address 192.168.0.255;
Option routers 192.168.0.254;
Option domain-name-servers 192.168.0.1, 192.168.0.2;
Option domain-name "mydomain.org ";
Subnet 192.168.0.0 netmask 255.255.255.0 {
Range 192.168.0.10 192.168.0.100;
}
Host q10 {
Hardware ethernet 00: 00: F0: 6B: 38: 5B;
Fixed-address 192.168.0.22;
}




Several key parts in the dhcpd. conf configuration file are described as follows: host q10 {...} Defines the relationship between the MAC address and IP address of the laptop Q10 Nic, indicating that the DHCP Server assigns a fixed IP address for Q10: 192.168.0.22; filename "" specifies the name of the bootstrap file; netx-server specifies the address of the TFTP Server. For other configurations, see the manual of DHCP Server.

2) configure the TFTP server

Tftp-hpa is selected. The configuration file of the TFTP Server is/etc/xinetd. d/tftp. The content of the configuration file is as follows:


Service tftp
{
Socket_type = dgram
Protocol = udp
Wait = yes
User = root
Server =/usr/sbin/in. tftpd
Server_args =-u nobody-s/tftpboot
Disable = no
Per_source = 11
CPIs = 100 2
}




Here,/tftpboot is the root directory location of the TFTP Server.

3) Configure bootstrap

The bootstrap file is specified as the pxelinux.0 file in dhcpd. conf and placed in/tftpboot. Linux Kernel and Linux root file system are also placed in/tftpboot. During the execution of pxelinux.0, all the configuration files are stored in the/tftpboot/pxelinux. cfg/directory. PXElinux provides different linux kernels and root file systems for different PXE clients. Therefore, different configuration file names must be used to differentiate different PXE clients. For example, if the IP address assigned by the DHCP Server to a PXE Client is 192.168.0.22, the corresponding configuration file name is/tftpboot/pxelinux. cfg/C0A80016 (Note: C0A80016 is the hexadecimal representation of IP address 192.168.0.22 ). If no configuration file is found, C0A80016-> C0A8001-> C0A800-> C0A80-> C0A8-> C0A-> C0-> C-> default is used to find the configuration file.

The configuration file/tftpboot/pxelinux. cft/C0A80001 contains the following content:

DEFAULT install
PROMPT 1
LABEL install
KERNEL vmlinuz
APPEND initrd = initrd. img devfs = nomount ramdisk_size = 16384

This configuration file specifies the names of the Linux kernel and the root file system, and passes some parameters to the kernel. The ramdisk_size parameter must be noted that it specifies the size of the ramdisk created after the Linux kernel is started, if the setting is too small, the installation process of Linux may fail.

4) create a Linux kernel/root file system

Because you need to install it through the network, select E: \ images \ bootnet. img (drive letter is E :) In all the Redhat Linux 8.0 installation disks (disk #1 :). Bootnet. img includes Linux kernel and Linux root file system (including installer ). Use bootnet. img to create a boot floppy disk. Run E: \ dosutils \ rawrite E: \ images \ bootnet. img on the doscommand line. After the preparation, copy the vmlinuz (Linux kernel) and initrd. img (Linux root file system) in the boot floppy disk to/tftpboot on the Linux Server.

5) Start DHCP Server/TFTP Server

On Linux Server, run service dhcpd start and service xinetd restart.

6) Start Q10

After the Q10 power-on, when the Samsung logo appears, the user will be prompted to press F12 in the lower left corner to enter the network boot. Press F12 and then Q10 enters the network boot process. First, the IP address is obtained through the DHCP Server, and then the bootstrap file pxelinux.0 is downloaded and executed. During the execution, the configuration file/tftpboot/pxelinux. cfg/C0A80016 is read. At this point, the screen displays boot:, press install, and the network installation interface of Redhat Linux 8.0 is displayed. Everything is OK!

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.