准备工作
1.安装KICKSTART
star@Ubuntu:~$ sudo apt-get install system-config-kickstart -y
1.1在 “应用程序\系统工具”中打开kickstart
基本的配置:
安装模式:这里选择http
引导启动选项:默认即可
分区情况:您可以根据实际情况进行分区
网络配置:增加一网卡设置为dhcp获取ip
认证模式可以按默认即可
用户设置:
防火墙和显示器的配置都可以根据需要设置,或按默认即可
软件包的选择:这里应该是ubuntu中kickstart的bug吧,没有显示可选的软件包,一会生成ks.cfg文件我们根据需要添加
安装前后预处理脚本,可以根据需要定制,这里简单举个例子:系统安装完之后把主机名改为 pxeclient
保存ks.cfg文件:
修改ks.cfg文件
在skipx后加入
%packages #这是server version的没有桌面
#@ubuntu-desktop #这是ubuntu桌面版的,如果要安装的话把#去掉
注意:alternate 既有桌面版也支持server版,所以叫做二选一
最后把ks.cfg文件移到/var/www/html目录下
#mv ks.cfg /var/www/html/
#我的配置文件内容
#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T
#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$gieKLFiM$jv5agaxq4QpX3lxpHR3UE1
#Initial user
user linux --fullname "linux" --iscrypted --password $1$y6kFWox0$S1OjQi4EbddMLnTbKoNiP0
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://192.168.1.156/ubuntu12
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
#Disk partitioning information
part /boot --fstype ext4 --size 256
part swap --size 1024
part / --fstype ext4 --size 1 --grow
#part / --fstype ext4 --size 1 --grow
#System authorization infomation
auth --useshadow --enablemd5
#Network information
#network --bootproto=dhcp --device=eth0
network --bootproto=dhcp --device=eth0 \
--gateway=192.168.1.1 --nameserver=8.8.8.8
#Firewall configuration
firewall --disabled
#X Window System configuration information
xconfig --depth=8 --resolution=800x600 --defaultdesktop=GNOME --startxonboot
@ubuntu-desktop
设置好以后,保存配置文件为ks.cfg
subnet 192.168.1.156 netmask 255.255.255.0 {
3.安装TFTP服务器
注意:必须使用TFTP-HPA这个软件包,使用TFTPD会出现问题导致不能导引导系统
star@Ubuntu:/$ sudo apt-get install tftpd-hpa tftp-hpa
配置tftp
# vim /etc/default/tftpd-hpa
增加以下两行:
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"
netboot 下载网址:http://cdimage.ubuntu.com/netboot/14.04/
下载那个netboot.tar.gz 即可
cd /var/lib/tftpboot
wget -r http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/ netboot.tar.gzlabel install
menu label ^Install
menu default
kernel ubuntu-installer/amd64/linux
append ks= http://192.168.1.156/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
最后加入一句 ServerName localhost:80
menu label ^Net ks
menu default
kernel ubuntu-installer/amd64/linux
append ks= http://192.168.1.156/ks.cfg vga=788 initrd=ubuntu-installer/amd64/initrd.gz -- quiet