PXE配置

参见:
(1)https://blog.csdn.net/wanpengpenga/article/details/81233803
(2)https://blog.csdn.net/ymeng9527/article/details/89520598
1、DHCP
$sudo apt-get install isc-dhcp-server

在配置文件(/etc/dhcp/dhcpd.conf)中添加
subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.2 192.168.2.254;
  option domain-name-servers 202.107.117.11;
  option domain-name "internal.example.org";
  option subnet-mask 255.255.255.0;
  option routers 192.168.2.50;
  option broadcast-address 192.168.2.255;
  default-lease-time 600;
  max-lease-time 7200;
  next-server 192.168.2.1;
  filename "pxelinux.0";
}
重启dhcp
$sudo service isc-dhcp-server restart

2、tftp
$sudo apt-get install tftp-server
/var/lib/tftpboot
配置/var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
timeout 30
prompt 1
menu title Welcome
label install 
menu default
kernel vmlinuz biosdevname=0
append boot=casper automatic-ubiquity netboot=nfs nfsroot=192.168.2.1:/var/www/html/ubuntu2 ks=ftp://192.168.2.1/ks.cfg live-installer/net-image=ftp://192.168.2.1/ubuntu2/casper/filesystem.squashfs initrd=initrd ksdevice=bootif netcfg/choose_interface=eth0 netcfg/dhcp_timeout=120 url=ftp://192.168.2.1/ubuntu.seed 
注:url=ftp://192.168.2.1/ubuntu.seed不知道是否生效,该文件是系统iso中的preseed,并添加了live-installer/net-image=ftp://192.168.2.1/ubuntu/casper/filesystem.squashfs

3、syslinux
$sudo apt-get install syslinux
需要pxelinux.0可以从ubuntu的网络安装镜像下载
http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-i386/current/images/netboot/

注:前期可以只配置kernel和initrd两个文件,验证dhcp和pxelinux是否可行,至此应该client是能够完成initram的阶段


4、NFS
参见:https://www.cnblogs.com/alonones/p/6105586.html
$sudo apt-get install nfs-kernel-server
/etc/exports
/var/www/html/ubuntu2 *(ro,async,no_root_squash,no_subtree_check)
/var/www/html *(ro,async,no_root_squash,no_subtree_check)


5、vsftp
$apt-get install system-config-kickstart
/etc/vsftpd.conf
anonymous_enable=YES
secure_chroot_dir=/var/www/html/


6、kickstart配置
配置/var/lib/tftpboot/pxelinux.cfg/中的ks.cfg,实现无人值守安装
参见:https://www.linuxidc.com/Linux/2017-09/146763.htm
$sudo apt-get install ubuntu-desktop
$sudo apt-get install system-config-kickstart

7、配置ubuntu安装的iso
$sudo mount -o loop ubuntu-14.04.6-desktop-i386.iso  /var/www/html/ubuntu
$mkdir /var/www/html/ubuntu2

 

pxelinux.cfg/default:

default vesamenu.c32
timeout 30
prompt 1
menu title Welcome
label install 
menu default
kernel vmlinuz biosdevname=0
append boot=casper automatic-ubiquity netboot=nfs nfsroot=192.168.2.1:/var/www/html/ubuntu2 ks=ftp://192.168.2.1/ks.cfg live-installer/net-image=ftp://192.168.2.1/ubuntu2/casper/filesystem.squashfs initrd=initrd ksdevice=bootif netcfg/choose_interface=eth0 netcfg/dhcp_timeout=120 url=ftp://192.168.2.1/ubuntu.seed 
 

pxelinux.cfg/isolinux.cfg:

# D-I config version 2.0
include menu.cfg
default vesamenu.c32
prompt 0
timeout 50
ui gfxboot bootlogo
 

ks.cfg:

#Generated by Kickstart Configurator
#platform=x86

#System language
lang zh_CN
#Language modules to install
langsupport zh_CN
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone Asia/Hong_Kong
#Root password
rootpw --iscrypted $1$1Mb3IwyH$ShaS1d1J0/52goBxeTZBC.
#Initial user
user username --fullname "username" --iscrypted --password $1$AkancAC0$4VsNf0X70iTFUZqTBkvF6.
#Install OS instead of upgrade
install
#Use Web installation
url --url ftp://192.168.2.1/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 --asprimary 
part / --fstype ext4 --size 80000 
part swap --size 2000 
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
#Package install information
%packages
@ ubuntu-desktop
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值