Method of installing Linux (CentOS) system through the network

  

First, the principle

One server without optical drive or floppy drive, want to install Linux system. We need to install Linux after booting through the PXE protocol of the network card. Process: machine boot - NIC boot - obtain IP address via DHCP - get the most basic kernel file through tftp, use the kernel file to start the machine - after booting, you can configure the installer, choose to use http, ftp, nfs to remotely get the installation The required package.

Obviously, the network installation must be configured on the server side. Our server needs to provide the following services:

DHCP

TFTP

HTTP(FTP, NFS)

Second, Service Configuration

1, DHCP

Profile:

option domain-name "mydomain";

ddns-update-style none;

default-lease- Time 600;

max-lease-time 7200;

server-name "bootserver";

subnet 192.168.123.0 netmask 255.255.255.0 {

Range 192.168.123.200 192.168.123.201;

deny unknown-clients;

}

host MyP5 {

filename "pxelinux.0";

server-name "bootserver";

hardware ethernet ae:32:20:00:b0:02;

fixed-address 192.168.123.90;

}

This is the copied configuration file, a little explanation:

filename is followed by the file in the tftp directory, and pxelinux.0 is the file in the syslinux package. The default pxelinux.0 may be in the /usr/lib/syslinux directory and must be copied to the tftp directory.

Hard under MyP5:

hardware ethernet ae:32:20:00:b0:02;

fixed-address 192.168.123.90;

is the MAC address of the client (the machine that needs to install the system) and the assigned IP address.

2, TFTP

Since the TSIZE protocol must be supported, the original TFTP package cannot be installed. I chose to use tftp-hpa.

Edit the file /etc/xinetd.d/tftp (if not, add the tftp file) (If xinetd.d does not exist, please install the xinetd package)

# default: off

# description: The tftp server serves files using the trivial file transfer \\

# protocol. The tftp protocol is often used to boot diskless \\

# workstations, download configuration files to Network-aware printers, \\

# and to start the installation process for some operating systems.

service tftp

{

disable = no

socket_type = dgram

protocol = udp

wait = yes

user = root

server = /usr/sbin/in.tftpd

server_args = -s /tftpboot

per_source = 11

cps = 100 2

flags = IPv4

}

This defines /tftpboot as the default directory for the tftp service, which you can modify yourself.

After saving, restart the /etc/init.d/xinetd service to start the tftp service.

How to test if tftp is successfully turned on?

Create a file in the tftp directory, such as 1.txt.

Connecting the tftp service in the Shell:

tftp 127.0.0.1

tftp>get 1.txt

If the service is successfully turned on, you can see A prompt to successfully download a file. And find the 1.txt file in the current directory.

Then copy the vmlinuz and initrd.img files in the isolinux directory on the CD to the /tftpboot directory.

Create the folder syslinux.cfg in /tftpboot. Two configuration files for pxelinux are saved in syslinux.cfg: default, list.

default:

default linux

label linux

kernel vmlinuz

append initrd=initrd.img devfs=nomount nofb ramdisk_size= 9216

You can write a lot of labels, depending on how many versions of Linux you want to provide on this server to the client. A version of a label, of course, the kernel, and initrd file names can not be repeated.

list:

Choose one of the following Linux distributions for your installation:

Name Distribution Arch. Installation media

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

CentOS CentOS 4.4 i386 192.168.99.90:/

You can also add multiple lines to choose different distributions. version. Fill in the contents under Name when you choose.

Three, copy the CD file

Copy the CD file to the corresponding directory (ftp, http, nfs), if you use http use the following command to copy multiple CDs into a directory: < Br>

[root@bootserver] # cp -arv /media/cdrom/* /install

If you use ftp, make sure you can access it (you can have a username and password).

Copyright © Windows knowledge All Rights Reserved