Linux network-based batch installation tutorial, DHCP server + TFTP server + FTP Server + Kickstart file,

Source: Internet
Author: User

Linux network-based batch installation tutorial, DHCP server + TFTP server + FTP Server + Kickstart file,

Preparation:

DHCP server

TFTP Server

FTP Server

Kickstart File

A client with a pxe rom chip that supports Network startup, that is, a bare metal that requires system installation

Linux image files

Here, a host provides DHCP, TFTP, and FTP services at the same time, and kickstart is also deployed on this server.

Principle

The remote client computer starts. Because the BIOS sets the NIC to start, the program in the pxe rom of the NIC is transferred to the memory for execution. First, the client finds the DHCP server in the network and then requests an IP address. At the same time, the DHCP server contacts the TFTP server and sends a bootstrap (bootstrap program) to the client ). After the client receives the bootstrap (File pxelinux.0) and runs the command, bootstrap requests TFTP to transfer the bootstrap configuration file (pxelinux. cfg ). Read the configuration file after receiving it. The client requests TFTP to transfer the kernel image file (vmlinuz) and the root file system file (initrd. img) based on the configuration file content and customer information ). Finally, start the kernel. This is a complete pxe build process. However, to enable the NIC to start and then install the system on the network, the FTP service also needs to place the required installation files in the FTP directory for transmission and installation.

Install

[Plain] view plain copy

# Yum-disablerepo = \ * -- enablerepo = c5-mediainstalldchp * tftp * ftp * system-config-kickstart *

Configuration Service

After DHCP is installed, the configuration file is empty. We can modify it according to the sample in the document.

[Plain] view plain copy

[Root @ pxe ~] # Cat/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample>/etc/dhcpd. conf

Then modify its content

[Plain] view plain copy

[Root @ pxe ~] # Vi/etc/dhcpd. confddns-update-styleinterim;

Ignoreclient-updates; allowbooting; # newly added

Allowbootp; # Add subnet192.168.128.0netmask1_255.255.0 {

# --- Defagateway Gateway

Optionrouters192.168.128.1; optionsubnet-mask255.255.255.0;

Optionnis-domain "domain.org ";

Optiondomain-name "domain.org"; # optiondomain-name-servers192.168.128.1; # comment this line to speed up startup

Optiontime-offset-18000; # EasternStandardTime

# Optionntp-servers192.168.1.1; # optionnetbios-name-servers192.168.1.1;

# --- Selectspoint-to-pointnode (defaultishybrid). Don't 'tchangethisunless # -- youunderstandNetbiosverywell

# Optionnetbios-node-type2;

Rangedynamic-bootp192.168.128.150192.168.128.200; filename "/pxelinux.0"; # specify the Startup File

Next-server192.168.128.111; # specify the server IPdefault-lease-time21600;

Max-lease-time43200;

# Wewantthenameservertoappearatafixedaddresshostns {

Next-servermarvin.redhat.com; hardwareethernet12: 34: 56: 78: AB: CD;

Fixed-address207.175.42.254 ;}

}

Modify the configuration of TFTP

[Plain] view plain copy

[Root @ pxe ~] # Cat/etc/xinetd. d/tftp # default: off

# Description: Thetftpserverservesfilesusingthetrivialfiletransfer \ # protocol. Thetftpprotocolisoftenusedtobootdiskless \

# Workstations, downloadconfigurationfilestonetwork-awareprinters, \ # andtostarttheinstallationprocessforsomeoperatingsystems.

Servicetftp {

Socket_type = dgramprotocol = udp

Wait = yesuser = root

Server =/usr/sbin/in. tftpdserver_args =-s/tftpboot

Disable = no # change yes to noper_source = 11

Cps = 1002 flags = IPv4

}

FTP uses Anonymous logon and the default directory/var/ftp. The configuration is not modified. You only need to put the linux image file under/var/ftp.

[Plain] view plain copy

[Root @ pxe ~] # Ls/var/ftp/cdrom/CentOSimagesRELEASE-NOTES-csRELEASE-NOTES-de.htmlRELEASE-NOTES-en_USRELEASE-NOTES-es.htmlRELEASE-NOTES-jaRELEASE-NOTES-nl.htmlRELEASE-NOTES-roRPM-GPG-KEY-beta

EULAisolinuxRELEASE-NOTES-cs.htmlRELEASE-NOTES-enRELEASE-NOTES-en_US.htmlRELEASE-NOTES-frRELEASE-NOTES-ja.htmlRELEASE-NOTES-pt_BRRELEASE-NOTES-ro.htmlRPM-GPG-KEY-CentOS-5GPLNOTESRELEASE-NOTES-deRELEASE-NOTES-en.htmlRELEASE-NOTES-esRELEASE-NOTES-fr.htmlRELEASE-NOTES-nlRELEASE-NOTES-pt_BR.htmlrepodataTRANS.TBL

 

After the TFTP service is installed, a/tftpboot directory will be created. This directory is used to place the bootstrap Boot Program (pxelinux.0), bootstrap configuration file (default), and kernel image (vmlinuz) and file system files (initrd. img. Here we need to first create a pxelinux. cfg directory and put the default file under it.

[Plain] view plain copy

[Root @ pxe ~] # Ll/tftpboot/total 9828

-Rw-r -- 1rootroot805661404-1800: 57initrd. img-rw-r -- 1rootroot1314804-1920: 22pxelinux. 0

Drwxr-xr-x2rootroot409604-2018: 40pxelinux. cfg-rw-r -- 1rootroot195366004-1920: 21 vmlinuz

[Root @ pxe ~] # Ll/tftpboot/pxelinux. cfg/Total 8

-Rwxr-xr-x1rootroot39604-1922: 03 default

Source of the above four files:

[Plain] view plain copy

[Root @ pxe ~] # Cp/usr/lib/syslinux/pxelinux.0/tftpboot/[root @ pxe ~] # Cd/var/ftp/cdrom/isolinux/

[Root @ pxeisolinux] # pwd/var/ftp/cdrom/isolinux

[Root @ pxeisolinux] # cpinitrd. imgisolinux. Unzip vmlinuz/tftpboot/

Here, isolinux. cfg is our default file. We need to rename it and put it under the pxelinux. cfg directory.

[Plain] view plain copy

[Root @ pxetftpboot] # mkdirpxelinux. cfg/[root @ pxetftpboot] # mvisolinux. cfgpxelinux. cfg/

[Root @ pxetftpboot] # cdpxelinux. cfg/[root@pxepxelinux.cfg] # mvisolinux. Configure Default

 

We also need some settings for the default file.

[Plain] view plain copy

[Root@pxepxelinux.cfg] # videfadefadefalinux Linux

Prompt1timeout600

Displayboot. msgF1boot. msg

F2options. msgF3general. msg

F4param. msgF5rescue. msg

Labellinuxkernelvmlinuz

# Ks = ftp: // 192.168.128.111/ks. cfg points to the file under the ftp server/var/ftp, which is the response file installed in linux, that is, the Kickstart file appendks = ftp: // 192.168.128.111/ks. cfginitrd = initrd. img

Labeltextkernelvmlinuz

Appendinitrd = initrd. imgtextlabelks

Kernelvmlinuzappendksinitrd = initrd. img

Labellocallocalboot1

Labelmemtest86kernelmemtest

Append-

For more information about how to create a kickstart file, see configure and use Kickstart.

Put the ks. cfg file under/var/ftp.

[Plain] view plain copy

[Root @ pxeftp] # ll total 24

Drwxr-xr-x7rootroot409604-1923: 04cdrom-rw-r -- r -- 1rootroot139904-2020: 41ks. cfg

Drwxr-xr-x2rootroot409604-2020: 43pub.

 

Start the service

Start DHCP Service

[Plain] view plain copy

[Root @ pxeftp] # servicedhcpdstart

Start the TFTP service

[Plain] view plain copy

[Root @ pxeftp] # servicexinetdstart start FTP service [plain] view plain copy

[Root @ pxeftp] # servicevsftpdstart

Now, the server configuration is complete.

Start the bare metal instance from the network.

Source: http://blog.csdn.net/limb99/article/details/7481878

Supplement: Use kickstart configuration based on graphic interface

Operating System: CentOS_5.5_Final (64bit)

First install system-config-kickstart

# Yum-disablerepo = \ * -- enablerepo = The c5-media install system-config-kickstart *

Change file name CentOS-Base.repo to CentOS-Base.repo.bk

# Mv/etc/yum. repos. d/CentOS-Base.repo/etc/yum. repos. d/CentOS-Base.repo.bk

If you do not do one step, when you start Kickstart, it will go to the official website to update the category list. After you change the name, kickstart will obtain the category list based on the Local CD image.

Add base tag

# Vi/etc/yum. repos. d/CentOS-Media.repo Add the following content

[Base]

Name = base

Baseurl = file: // media/CentOS_5.5_Final/# This is your CD mount point

Enable = 1

Gpgcheck = 0

If this step is not done, the following questions will appear:

OK. Now you can use the system-config-kickstart command to start the kickstart program.

I use ftp for installation and anonymous logon. The default directory is/var/ftp.

 

Use the default option here.

 

Note. Partitions are customized as needed.

 

 

I use DHCP for the network.

 

Use the default option for verification.

 

Define as needed

 

Define as needed

 

Select save file.

Additional reading

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.