PXE automatic installation

Source: Internet
Author: User
Tags snmp

PXE Automatic installation method
    1. Install the base component package

Ensure that you have installed the operating system, and as a PXE Server, we recommend using the latest version of Rhel 6.

    1. Create a Yum installation source.

Cat>>/etc/yum.repos.d/rhel-dvd.repo<<!
[Rhel-dvd]
name=red Hat Enterprise Linux DVD
Baseurl=file:///media/rhel6-dvd
Enabled=1
Gpgcheck=0
!

You need to make sure that the CD is mounted to the/media/rhel6-dvd directory. As follows:

# Mkdir/media/rhel6-dvd

# Mount–o Loop/dev/sr0/media/rhel6-dvd

    1. Install the required component packages


yum-y Install DHCP Tftp-server syslinux httpd

    1. Configure the underlying service
      1. Configuring DHCP and TFTP services

# cat >>/etc/dhcp/dhcpd.conf <<!
Option Domain-name "pxe.com";
Option Domain-name-servers 192.168.157.254;
Option routers 192.168.157.254;
Default-lease-time 14400;
Ddns-update-style none;
########### provideTFTPserver address and startup file#####################
next-server 192.168.157.254;
filename "pxelinux.0";
Allow booting;
Allow BOOTP;
#############################################################
Subnet 192.168.157.0 netmask 255.255.255.0 {
range 192.168.157.10 192.168.157.100;
Default-lease-time 14400;
max-lease-time 172800;
}
########## Assigning a client to a specified IP ###############################
Host Liujia {
Hardware Ethernet 00:0c:29:e5:c5:28;
Fixed-address 192.168.157.200;
}
#############################################################

Note: You need to make sure you are currently using DHCP distribution of the network card, set the above configured IP, 192.168.157.254

    1. Start the service, add boot auto-start

Chkconfig TFTP on

/etc/init.d/xinetd start

Chkconfig DHCPD on

/ETC/INIT.D/DHCPD start

Chkconfig httpd on

/ETC/INIT.D/HTTPD start

    1. Create an install HTTP installation source directory

# cd/var/www/html/

# mkdir Wwwrepo ks

# cp–r/media/rhel6-dvd/* Wwwrepo

    1. Create a PXE component directory schema

[Email protected]]# pwd

/var/lib/tftpboot

[Email protected]]# tree.

.

├──boot.msg----files from the RHEL6 disc DVD directory Isolinux/boot.msg

├──memtest----files from the RHEL6 disc DVD directory Isolinux/memtest

├──pxelinux.0----file originated from the operating system/usr/share/syslinux/pxelinux.0

├──PXELINUX.CFG-----mkdir Create it Yourself

│└──default----files from the RHEL6 disc DVD directory Isolinux/isolinux.cfg

├──rhel6u6-----mkdir Create it Yourself

│├──initrd.img-----Files from the RHEL6 disc DVD directory Isolinux

│└──vmlinuz-----Files from the RHEL6 disc DVD directory Isolinux

├──splash.jpg-----Files from the RHEL6 disc DVD directory Isolinux

└──VESAMENU.C32-----Files from the RHEL6 disc DVD directory Isolinux

2 directories, 8 files

Execute the following command:

# Cd/var/lib/tftpboot

# mkdir Pxelinux.cfg Rhel6u6

#cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot

# cp/media/rhel6-dvd/isolinux/boot.msg/var/lib/tftpboot/

# cp/media/rhel6-dvd/isolinux/memtest/var/lib/tftpboot/

# Cp/media/rhel6-dvd/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default

# Cp/media/rhel6-dvd/isolinux/initrd.img/var/lib/tftpboot/rhel6u6

# Cp/media/rhel6-dvd/isolinux/vmlinuz/var/lib/tftpboot/rhel6u6

# cp/media/rhel6-dvd/isolinux/splash.jpg/var/lib/tftpboot/

# cp/media/rhel6-dvd/isolinux/vesamenu.c32/var/lib/tftpboot/

    1. Modify the PXE boot menu

Edit File/var/lib/tftpboot/pxelinux.cfg/default

Default Vesamenu.c32

#prompt 1

Timeout 600

Display Boot.msg

Menu Background Splash.jpg

Menu title Welcome to Red Hat Enterprise Linux 6.6!

Menu Color Border 0 #ffffffff #00000000

Menu Color SEL 7 #ffffffff #ff000000

Menu Color Title 0 #ffffffff #00000000

Menu Color tabmsg 0 #ffffffff #00000000

Menu Color Unsel 0 #ffffffff #00000000

Menu Color Hotsel 0 #ff000000 #ffffffff

Menu Color Hotkey 7 #ffffffff #ff000000

Menu Color ScrollBar 0 #ffffffff #00000000

Label Local

Menu label boot from local hard drive

Localboot 0

Labelvesa

Menu label Auto Install system with KS file

Kernel/rhel6u6/vmlinuz

Appendinitrd=/rhel6u6/initrd.img KS=HTTP://192.168.157.254/KS/RHEL6U6.KS Ksdevice=bootif

Ipappend 2

Label Rescue

Menu Label ^rescue installed system

Kernel Vmlinuz

Appendinitrd=initrd.img Rescue

Label Memtest86

Menu Label ^memory Test

Kernelmemtest

Append-

    1. Create a Kickstart file

# Cd/var/www/html/ks

# VI RHEL6U6.KS

#platform =x86, AMD64, or Intel EM64T

#version =devel

# Install OS instead of upgrade

Install

# Use Network Installation

URL--url=http://192.168.157.254/wwwrepo/rhel6u6/

# Root Password

ROOTPW--plaintext root1234

# System Authorization Information

Auth--useshadow--passalgo=sha512

# Use graphical Install

Graphical

Firstboot--disable

# System Keyboard

Keyboard US

# System Language

Langen_us

# SELinux Configuration

SELinux--disabled

# Firewall Configuration

Firewall--disabled

# Installation Logging Level

Logging--level=info

#Reboot after installation

Reboot

Services--disabled Udev-post,rpcidmapd,rpcgssd,rpcbind,rhsmcertd,rhnsd,postfix,mdmonitor,lvm2-monitor, Libvirt-guests,iptables,ip6tables,cups,bluetooth,avahi-daemon,autofs,atd,abrtd,abrt-oops,abrt-ccpp, networkmanager,gpm

Services--enabled KDUMP,NTPD

# System TimeZone

TimeZone Asia/shanghai

# Network Information

Network--bootproto=dhcp--device=em2--onboot=on

# System Bootloader Configuration

bootloader--location=mbr--driveorder=sda--append= "RHGB quiet"

# Clear the Master Boot Record

Zerombr

Clearpart--all--initlabel

Ignoredisk--ONLY-USE=SDA

Part/boot--fstype= "Ext4"--ondisk=sda--size=1024

Part pv.008002--grow--ONDISK=SDA--size=200

Volgroupvolgroup--pesize=4096 pv.008002

Logvol/--FSTYPE=EXT4--name=lv_root--vgname=volgroup--size=5000

Logvol Swap--name=lv_swap--vgname=volgroup--size=1024

%packages

@base

@chinese-support

@core

Net-snmp

Net-snmp-libs

Net-snmp-utils

Ntp

Ntpdate

Gcc

Gcc-c++

Openssh-server

Openssh-clients

Sysstat

Lzo

Vsftpd

Ncompress

Make

%end

%post--log=/tmp/ks.log--interpreter=/bin/bash

Cat>>/etc/yum.repos.d/rhel-dvd.repo<<!

[Rhel-dvd]

name=red Hat Enterprise Linux DVD

baseurl=http://192.168.157.254/wwwrepo/rhel6u6/

Enabled=1

Gpgcheck=0

!

%end

Summary of issues

    1. Dell only has one first NIC that starts PXE by default

You need to modify the network card in your actual environment to configure it. Enter the NIC configuration interface to configure.

    1. When there are multiple NICs, the installation interface stops on the NIC selection

To modify the PXE menu boot configuration, add a similar following:

Labelvesa

Menu label Auto Install system with KS file

Kernel/rhel6u6/vmlinuz

APPENDINITRD=/RHEL6U6/INITRD.IMGKS=HTTP://192.168.157.254/KS/RHEL6U6.KSksdevice=bootif

Ipappend 2

PXE automatic 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.