Kickstart+tftp自动部署Ubuntu 14.04:
mkdir /root/iso
mount -t iso9660 -r -o ro,loop ubuntu-14.04.3-server-amd64.iso /root/iso/
mkdir /var/www/html/ks/ubt14043
rsync -av --proagress /root/iso/* /var/www/html/ks/ubt14043/
rm -rf /var/www/html/index.html
vi /var/www/html/ks/preseed/ubuntu-server.seed (在base-installer行的下一行添加,preseed目录下的几个文件都需要添加)
d-i live-installer/net-image string http://10.0.0.2/ks/ubt14043/install/filesystem.squashfs
:wq
rsync -av --progress /root/iso/install/netboot/* /var/lib/tftpboot/
vi /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg (label cli的上一行,改掉)
append ks=http://10.0.0.2/ks/ksubt14043.cfg vga=788 initrd=ubuntu-installer/amd64/initrd.gz live-installer/net-image=http://10.0.0.2/ks/ubt14043/install/filesystem.squashfs
:wq
到已有Ubuntu vnc图形界面(apt-get install system-config-kickstart)
system-config-kickstart
installation Method——HTTP——HTTP Server:10.0.0.2 HTTP Directory:/ks/ubt14043
Partition Information 设置/分区和swap分区 (均为P主分区)
Network Configuration——Add Network Device—— eth0 DHCP
File——Save File (默认为/root/ks.cfg)
cp -rv /root/ks.cfg /var/www/html/ks/ksubt14043.cfg
vi /var/www/html/ks/ksubt14043.cfg
timezone Asia/Shanghai (默认为美国时区)
part /boot/efi --fstype vfat --size 1000 --asprimary --ondisk sda(手动添加efi分区)
network --bootproto=dhcp --device=em1 (将eth0改为em1)
:wq
cat /var/www/html/ks/ksubt14043.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 --disabled
#Initial user
user super --fullname "super" --iscrypted --password $1$.ljIjOMi$vFieciSvR.iGv3uyiVV9D1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://10.0.0.2/ks/ubt14043
#System bootloader configuration
bootloader --location=mbr
#bootloader --driveorder=partition
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
#clearpart --all --initlabel
clearpart --drives=sda --all
ignoredisk --only-use=sda
#Disk partitioning information
part / --fstype ext4 --size=100000 --asprimary
part /boot/efi --fstype ext4 --size 1000 --asprimary
part biosboot --fstype=biosboot --size=1
part swap --size=10000 --grow
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=em1
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
%post
mkdir /root/sh
wget -P /root/sh -c -r -np -nd -R index.html http://10.0.0.2/ks/ubt14043/sh/
chmod +x /root/sh/.sh
sh /root/sh/tftp.sh
%end
本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/2047323如需转载请自行联系原作者
yangzhimingg