PXE KICKSTART Ubuntu9.10 实战

PXE Kickstart Ubuntu 实战
Server配置
1.操作系统版本
root@autotest4132:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:        9.10
Codename:       karmic

2.配置sources.list
root@autotest4132:~# vim /etc/apt/sources.list

:%s$http://cn.archive.ubuntu.com$http://mirrors.sohu.com$g (换成合适自己的源)

3.更新系统
root@autotest4132:~# apt-get update

4.安装ubuntu桌面环境和kickstart
root@autotest4132:~# apt-get install ubuntu-desktop vncserver system-config-kickstart

5.Applications--System Tools--kickstart配置生成ks.cfg
确保IE能正常访问http://192.168.5.200/ubuntu/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$k431/JPO$soibz4./eEKvhUBJizxNm/
#Initial user
user autotest --fullname "" --iscrypted --password $1$qaRUI.uN$0v.KsQcdHM07Qga/xuwdW0
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://192.168.5.200/ubuntu
#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 20000
part / --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
%packages
openssh-server
nfs-kernel-server
vim

#%post
#sohu#
#sed -i s^http://192.168.5.200^http://mirrors.sohu.com^g /etc/apt/sources.list
#end#

6.安装配置DHCP服务
root@autotest4132:~# apt-get install dhcp3-server
root@autotest4132:~# sed '/^$/d' /etc/dhcp3/dhcpd.conf |grep -v '#'
ddns-update-style interim;
ignore client-updates;
option domain-name "openvps.com";  #随便定义一个
default-lease-time 21600;
max-lease-time 43200;
authourtative;
allow booting;
allow bootp;
log-facility local7;
subnet 192.168.5.0 netmask 255.255.255.0 {
  range 192.168.5.62 192.168.5.130;
  option routers 192.168.5.254;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 192.168.5.200,192.168.5.242;  #一定得填写,不然自动安装时会提示手动输入.
  default-lease-time 21600;
  max-lease-time 43200;
  server-name "192.168.5.200";
  next-server 192.168.5.200;
  filename "/pxelinux.0";
}

7.安装配置TFTP服务
root@autotest4132:~# cat /etc/xinetd.d/tftp
service tftp
{
        disable                 = no  #将"yes"更改为"no"
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -u nobody -s /var/lib/tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

root@autotest4132:~# cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="yes" #将"no"更改为"yes"
OPTIONS="-l -s /var/lib/tftpboot"

下载配置Grab the netboot images
root@autotest4132:~# wget http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-amd64/current/images/netboot/netboot.tar.gz
root@autotest4132:~# tar xvfz netboot.tar.gz -C /var/lib/tftpboot/
root@autotest4132:~# vim /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/text.cfg
default install
label install
        menu label ^Install
        menu default
        kernel ubuntu-installer/amd64/linux
        append ks=http://192.168.5.200/ubuntu/ks.cfg vga=normal 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=normal initrd=ubuntu-#installer/amd64/initrd.gz -- quiet

8.安装配置Apache服务
root@autotest4132:~# apt-get install apache2
root@autotest4132:~# wget -C http://releases.ubuntu.com/karmic/ubuntu-9.10-alternate-amd64.iso
root@autotest4132:~# mkdir -p /var/www/ubuntu/
root@autotest4132:~# tar xvfz ubuntu-9.10-alternate-amd64.iso -C /var/www/ubuntu/
root@autotest4132:~# cp Desktop/ks.cfg /var/www/ubuntu/
root@autotest4132:~# chmod -R 777 /var/www/ubuntu/


Client配置
1.BIOS中开启PXE引导选项
2.Enable "Virtualization Technology"
3.按顺序开机(获得连续IP,大量服务器时避免编号错误),开始全自动化安装

故障解决办法:
Error1.
PXE-E11:ARP timeout
PXE-E38: TFTP cannot open connection
PXE-MOF:Exiting PXE ROM.

两种原因
1.DHCP服务未配置正确(最大的原因next-server可能就出在这里)

2.交换机绑定了ARP 或使用了不响应ARP请求的路由(可以尝试使用傻瓜式交换机)

Error2.提示“Debootstrap warning http://server/ubuntu/dists/karmic/restricted/binary-amd64/Packages was corrupt”

解决办法
root@autotest4132:~# touch /var/www/ubuntu/dists/karmic/restricted/binary-amd64/Packages

Error3.
configuring net 要求输入"Name server address"

解决办法
在dhcpd.conf 中加入此参数option domain-name-servers

备注:wget -c -r -np -k -L -p http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-amd64/current/images/netboot/ 镜像所需文件内容

本文出自 “乡�B亻” 博客,谢绝转载!

你可能感兴趣的:(ubuntu,pxe,ks.cfg,kickstart,alternate)