自动化部署之(二)ubuntu无人值守安装系统

ubuntu无人值守安装系统,用于批量网络安装Ubuntu和debian

环境: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 http://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=http://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=http://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=http://192.168.56.11/ks.cfg vga=788 initrd=ubuntu-installer/amd64/initrd.gz live-installer/net-image=http://192.168.56.11/ubuntu/install/filesystem.squashfs clock-setup/ntp=false ip=dhcp ksdevice=bootif --- quit
声明:本文为原创,作者为 辣条①号,转载时请保留本声明及附带文章链接:https://boke.wsfnk.com/archives/386.html
谢谢你请我吃辣条谢谢你请我吃辣条

如果文章对你有帮助,欢迎点击上方按钮打赏作者

最后编辑于:2022/11/20作者: 辣条①号

现在在做什么? 接下来打算做什么? 你的目标什么? 期限还有多少? 进度如何? 不负遇见,不谈亏欠!

暂无评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

arrow grin ! ? cool roll eek evil razz mrgreen smile oops lol mad twisted wink idea cry shock neutral sad ???

文章目录