导读 无人值守安装(Unattended Setup)指软件安装时无需任何用户干预,直接按默认或通过应答文件设置安装,这对于无特殊需求的用户或企业大批量部署安装操作系统及软件时非常方便。
环境

Ubuntu-desktop(ip:192.168.56.11)

安装软件
apt install dnsmasq apache2 system-config-kickstart
配置dnsmasq
vim /etc/dnsmasq.conf

bogus-priv
filterwin2k 
interface=eth0
dhcp-range=192.168.5.150,192.168.5.250,12h  
dhcp-boot=pxelinux.0  
enable-tftp  
tftp-root=/var/ftpd  
dhcp-authoritative 

创建必要的目录

mkdir /var/ftpd
mkdir /var/www/ubuntu

挂载安装介质

mount /dev/cdroom /mnt
cp /mnt/* /var/www/ubuntu -arf

将网络启动文件复制到网络引导目录

cp /var/www/ubuntu/install/netboot/* /var/ftpd -arf/

修改apache2配置文件

vim /etc/apache2/sites-enabled/000-default.conf

DocumentRoot /var/www
#这里只给出了关键配置

运行system-config-kickstart生成ks.cfg文件

编辑响应文件ks.cfg

vim /var/www/ks.cfg

#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T

install
text
#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 wsfnk --fullname "wsfnk" --iscrypted --password $1$Q4SPUaqc$KCsPmeMevJS0zzrqLTeVw0
#Reboot after installation
reboot
#Use text mode install
#text
#Install OS instead of upgrade
#install
#Use Web installation
url --url //192.168.56.11/ubuntu
#System bootloader configuration
bootloader --location=mbr 
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel 
#Disk partitioning information
part swap --size 512 
part /boot --fstype ext4 --size 200 
part / --fstype ext4 --size 1 --grow 
#System authorization infomation
auth  --useshadow  --enablemd5 
#Firewall configuration
firewall --disabled 
#Do not configure the X Window System
skipx
%packages
openssh-server
openssh-client
gcc
g++
vim
curl

编辑引导文件

vim /var/ftpd/pxelinux.cfg/default

path ubuntu-installer/amd64/boot-screens/
include ubuntu-installer/amd64/boot-screens/menu.cfg
default ubuntu-installer/amd64/boot-screens/vesamenu.c32
default install
label install
kernel ubuntu-installer/amd64/linux
append ks=//192.168.56.11/ks.cfg initrd=ubuntu-installer/amd64/initrd.gz --
prompt 0
timeout 0
启动相关服务
systemctl start apache2
systemctl start dnsmasq

若安装出现如下错误,

请在ubuntu-installer/amd64/boot-screens/txt.cfg里,append加入如下配置

live-installer/net-image=//192.168.56.11/ubuntu/install/filesystem.squashfs clock-setup/ntp=false ip=dhcp ksdevice=bootif

解决图片所示的错误

vim /var/ftpd/ubuntu-installer/amd64/boot-screens/txt.cfg

default install
label install
menu label ^Install
kernel ubuntu-installer/amd64/linux
append ks=//192.168.56.11/ks.cfg vga=788 initrd=ubuntu-installer/amd64/initrd.gz live-installer/net-image=//192.168.56.11/ubuntu/install/filesystem.squashfs clock-setup/ntp=false ip=dhcp ksdevice=bootif --- quit

原文来自:

本文地址://q13zd.cn/ubuntu-installation-system.html编辑:xiangping wu,审核员:逄增宝

Linux大全:

Linux系统大全:

红帽认证RHCE考试心得: