pxeboot install centos7

来源:互联网 发布:云计算案例分析 编辑:程序博客网 时间:2024/06/05 15:49

# yum install -y  httpd  xinetd  tftp-server  dhcp  syslinux


# 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文件也要对应修改)

# chmod a+r /var/www/html/ks.cfg


#  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 dhcpd


#  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


0 0
原创粉丝点击