歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> pxeboot install centos7

pxeboot install centos7

日期:2017/3/3 12:33:59   编辑:Linux技術

# yum install -y httpd xinetd tftp-server

# mkdir /var/www/html/centos7

# mount -o loop centos7.iso /var/www/html/centos7

# cp /var/www/html/centos7/images/pxeboot/{vmlinuz initrd.img} /var/lib/tftpboot/

# cp /var/www/html/centos7/isolinux/{vesamenu.c32 boot.msg splash.png} /var/lib/tftpboot/

# mkdir /var/lib/tftpboot/pxelinux.cfg

# 編輯/var/lib/tftpboot/pxelinux.cfg/default (參考結尾)

# change /etc/xinetd.d/tftp "disable = yes" => "disable = no"

# cp ks.cfg to /var/www/html/ks.cfg (pxelinux.cfg/default文件也要對應修改)

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

# cat /etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

# see /usr/share/doc/dhcp*/dhcpd.conf.example

# see dhcpd.conf(5) man page

#

option domain-name "Robbie.com"; #全局搜索域

option domain-name-servers 218.2.135.1;#全局dns

default-lease-time 6000;# 默認的租賃時間

max-lease-time 72000;#最大可租賃時間

#上面兩個值可以設一樣

#class "test" {

#match if substring (hardware,1,8) = 00:1a:4a;

#}

subnet 192.168.0.0 netmask 255.255.0.0 {

interface eth0;

#range 192.168.10.67 192.168.10.80;

option routers 192.168.0.1;

next-server 192.168.10.60; #tftp server的ip

filename "pxelinux.0"; #pxe boot需要的啟動文件名, 相當於bootloader

class "test" {

match if substring (hardware,1,3) = 00:1a:4a;

}

pool {

range 192.168.10.67 192.168.10.70;

allow members of "test";

}

}

# systemctl start httpd xinetd tftp dhcp

# tee /var/lib/tftpboot/pxelinux.cfg/default <<EOF

default vesamenu.c32

timeout 80

display boot.msg

# Clear the screen when exiting the menu, instead of leaving the menu displayed.

# For vesamenu, this means the graphical background is still displayed without

# the menu itself for as long as the screen remains in graphics mode.

menu clear

menu background splash.png

menu title CentOS 7

menu vshift 8

menu rows 18

menu margin 8

#menu hidden

menu helpmsgrow 15

menu tabmsgrow 13

# Border Area

menu color border * #00000000 #00000000 none

# Selected item

menu color sel 0 #ffffffff #00000000 none

# Title bar

menu color title 0 #ff7ba3d0 #00000000 none

# Press [Tab] message

menu color tabmsg 0 #ff3a6496 #00000000 none

# Unselected menu item

menu color unsel 0 #84b8ffff #00000000 none

# Selected hotkey

menu color hotsel 0 #84b8ffff #00000000 none

# Unselected hotkey

menu color hotkey 0 #ffffffff #00000000 none

# Help text

menu color help 0 #ffffffff #00000000 none

# A scrollbar of some type? Not sure.

menu color scrollbar 0 #ffffffff #ff355594 none

# Timeout msg

menu color timeout 0 #ffffffff #00000000 none

menu color timeout_msg 0 #ffffffff #00000000 none

# Command prompt text

menu color cmdmark 0 #84b8ffff #00000000 none

menu color cmdline 0 #ffffffff #00000000 none

# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.

menu tabmsg Press Tab for full configuration options on menu items.

menu separator # insert an empty line

menu separator # insert an empty line

label custom

menu label ^Custom auto install

kernel vmlinuz

menu default

append initrd=initrd.img ip=dhcp inst.ks=http://192.168.10.60/ks.cfg

EOF

#

Copyright © Linux教程網 All Rights Reserved