首页 > 系统服务 > 详细

Ubuntu 16.04 PXE+kickstart部署系统

时间:2018-04-26 22:59:02      阅读:573      评论:0      收藏:0      [点我收藏+]

#PXE+TFTP+Kickstart 自动部署服务器系统
系统Ubuntu16.04
apt-get install isc-dhcp-server
vim /etc/default/isc-dhcp-server
INTERFACES="ens160"

在 /etc/dhcp/dhcpd.conf追加

allow booting;
allow bootp;
ddns-update-style interim;
ignore client-updates;
subnet 172.16.80.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option domain-name-servers 172.16.80.0;
range dynamic-bootp 172.16.80.220 172.16.80.230;
default-lease-time 21600;
max-lease-time 43200;
next-server 172.16.80.26;
filename "pxelinux.0";
}

 


#重启dhcp服务
service isc-dhcp-server restart

#安装tftp服务
apt-get install tftpd-hpa

#安装nginx
apt-get install nginx
#上传系统镜像到主机放到/usr/local/src,然后挂载到nginx网站目录
mount /usr/local/src/ubuntu-16.04.3-server-amd64.iso /var/www/html/ubuntu

cp -r /var/www/html/ubuntu/install/netboot/* /var/lib/tftpboot/

cp /var/www/html/ubuntu/preseed/ubuntu-server.seed /var/www/html/
#vim /var/www/html/ubuntu-server.seed 末尾添加:

d-i live-installer/net-image string http://10.0.0.100/ubuntu/install/filesystem.squashfs
d-i pkgsel/include string openssh-server

安装kickstart

vim /var/www/html/ks.cfg

#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 --utc Asia/Shanghai
#Root password
rootpw --disabled
#Initial user
#user ddif --fullname "ddif" --iscrypted --password $1$Umx1cgrj$..pRArN7AP66XBosYbU4N1
user ddif --fullname "ddif" --password BosYbU4N1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://172.16.80.25/ubuntu
#System bootloader configuration
bootloader --location=mbr 
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part / --fstype ext4 --size 1024 --asprimary --ondisk sda
part swap --size 800 --ondisk sda
#System authorization infomation
auth --useshadow --enablemd5
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
%post
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted" > /etc/apt/sources.list
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted" >> /etc/apt/sources.list
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe" >> /etc/apt/sources.list
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse" >> /etc/apt/sources.list
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse" >> /etc/apt/sources.list
echo "deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list

 

修改一下 /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://172.16.80.25/ks.cfg preseed/url=http://172.16.80.25/ubuntu-server.seed netcfg/get_nameservers=172.16.80.25 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

 

Ubuntu 16.04 PXE+kickstart部署系统

原文:https://www.cnblogs.com/ddif/p/8955021.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!