cundeng 发表于 2018-5-6 13:49:44

PXE KICKSTART Ubuntu12.04 实战

  操作系统版本
# cat /etc/issue
CentOS release 6.3 (Final)

1.配置DHCP
# yum -y install dhcp dhcp-common

# cat/etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd

ddns-update-style interim;
ignore client-updates;

option domain-name "openvps.com";

default-lease-time 21600;
max-lease-time 43200;

authoritative;
allow booting;
allow bootp;

log-facility local7;

subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.26 192.168.2.56;
option routers 192.168.2.254;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.2.25;
option broadcast-address 192.168.2.255;
default-lease-time 21600;
max-lease-time 43200;
server-name "192.168.2.25";
next-server 192.168.2.25;
filename "/pxelinux.0";
}

# chkconfig --levels 35 dhcpdon
# chkconfig --list |grep dhcpd
dhcpd         0:off   1:off   2:off   3:on    4:off   5:on    6:off
# service dhcpd restart

2.配置Apache
# yum -y install httpd
# cd /usr/local/games
# wget http://mirrors.163.com/ubuntu-releases/12.04/ubuntu-12.04-alternate-amd64.iso
# mount -o loop /usr/local/games/ubuntu-12.04-alternate-amd64.iso /var/www/html/ubuntu1204/
# service httpd restart
# chkconfig --levels 35 httpd on

3.配置tftp
# yum -y install tftp-server tftp

# cat /etc/xinetd.d/tftp
# 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
{
      socket_type             = dgram
      protocol                = udp
      wait                  = yes
      user                  = root
      server                  = /usr/sbin/in.tftpd
      server_args             = -s /var/lib/tftpboot
      disable               = no                      #"yes"改为"no"
      per_source            = 11
      cps                     = 100 2
      flags                   = IPv4
}
# cp -rf /var/www/html/ubuntu1204/install/netboot/*/var/lib/tftpboot/
# service xinetd restart

4.修改配置
增加ks=http://192.168.2.25/ks.cfg
# cat/var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg
default install
label install
      menu label ^Install
      menu default
      kernel ubuntu-installer/amd64/linux
      append ks=http://192.168.2.25/ks.cfg vga=788 initrd=ubuntu-installer/amd64/initrd.gz -- quiet
label cli
      menu label ^Command-line install
      kernel ubuntu-installer/amd64/linux
      append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=ubuntu-

installer/amd64/initrd.gz -- quiet

5.配置ks文件
通过system-config-kickstart界面生成ks.cfg文件
# apt-get install system-config-kickstart
# scp ks.cfg root@192.168.2.25:/var/www/html

附ks.cfg
#Generated by Kickstart Configurator
#platform=x86

#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $1$J0eYtxji$hzWrjxysHMaxAYPAEfwUp.
#Initial user
user --disabled
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://192.168.2.25/ubuntu1204
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext4 --size 200
part swap --size 1600
part / --fstype ext4 --size 10000
part /opt --fstype ext4 --size 1 --grow
#System authorization infomation
auth--useshadow--enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
页: [1]
查看完整版本: PXE KICKSTART Ubuntu12.04 实战