通过U盘全自动安装系统,除了启动时,其他时间不需要人工干预,自动按autoinstall配置文件完成肩语言、网卡及硬盘分区的工作,并最终完成系统的安装。
实现方法:
1.在U盘根目录新建文件夹 server 并放入配置文件 meta-data 和 user-data 。
以下内容是 user-data 文件内容(是基于手动安装后拷贝的安装文件做了许修改)
代码: 全选
#cloud-config
# See the autoinstall documentation at:
# https://canonical-subiquity.readthedocs-hosted.com/en/latest/reference/autoinstall-reference.html
autoinstall:
apt:
disable_components: []
fallback: offline-install
geoip: true
mirror-selection:
primary:
- country-mirror
- arches: &id001
- amd64
- i386
uri: http://archive.ubuntu.com/ubuntu/
- arches: &id002
- s390x
- arm64
- armhf
- powerpc
- ppc64el
- riscv64
uri: http://ports.ubuntu.com/ubuntu-ports
preserve_sources_list: false
security:
- arches: *id001
uri: http://security.ubuntu.com/ubuntu/
- arches: *id002
uri: http://ports.ubuntu.com/ubuntu-ports
codecs:
install: false
drivers:
install: false
identity:
hostname: hri-isp
password: $6$o53wh2M9AT0e8t//$hIjf/8gMmr5sET0ksVvbY9jZ5JXfr/5sTYu7aXiLO5ZR.nB2UmTwzs/uk5IkTBQIjGhhVDzvBcdB9ZeY2FqFg0
realname: hri
username: hri
kernel:
package: linux-generic
keyboard:
layout: us
toggle: null
variant: ''
locale: en_US.UTF-8
network:
ethernets:
eno1:
addresses:
- 192.168.61.21/24
nameservers:
addresses:
- 114.114.114.114
- 8.8.8.8
search: []
routes:
- to: default
via: 192.168.61.1
version: 2
oem:
install: auto
source:
id: ubuntu-server
search_drivers: false
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
config:
- ptable: gpt
serial: aigo_SSD_S500E_120GB_AHJ9082B17A1111
path: /dev/sda
wipe: superblock-recursive
preserve: false
name: ''
grub_device: false
id: disk-sda
type: disk
- device: disk-sda
size: 1.05G
wipe: superblock
flag: boot
number: 1
preserve: false
grub_device: true
offset: 1048576
path: /dev/sda1
id: partition-0
type: partition
- fstype: fat32
volume: partition-0
preserve: false
id: format-0
type: format
- device: disk-sda
size: 25G
wipe: superblock
number: 2
preserve: false
grub_device: false
offset: 1128267776
path: /dev/sda2
id: partition-1
type: partition
- fstype: ext4
volume: partition-1
preserve: false
id: format-1
type: format
- path: /
device: format-1
id: mount-2
type: mount
- device: disk-sda
size: 8G
wipe: superblock
flag: swap
number: 3
preserve: false
grub_device: false
offset: 27971813376
path: /dev/sda3
id: partition-2
type: partition
- fstype: swap
volume: partition-2
preserve: false
id: format-2
type: format
- path: ''
device: format-2
id: mount-3
type: mount
- device: disk-sda
size: 1G
wipe: superblock
number: 4
preserve: false
grub_device: false
offset: 36561747968
path: /dev/sda4
id: partition-3
type: partition
- fstype: ext4
volume: partition-3
preserve: false
id: format-3
type: format
- path: /boot
device: format-3
id: mount-4
type: mount
- device: disk-sda
size: 5G
wipe: superblock
number: 5
preserve: false
grub_device: false
offset: 37635489792
path: /dev/sda5
id: partition-4
type: partition
- fstype: ext4
volume: partition-4
preserve: false
id: format-4
type: format
- path: /tmp
device: format-4
id: mount-5
type: mount
- device: disk-sda
size: 5G
wipe: superblock
number: 6
preserve: false
grub_device: false
offset: 43004198912
path: /dev/sda6
id: partition-5
type: partition
- fstype: ext4
volume: partition-5
preserve: false
id: format-5
type: format
- path: /var
device: format-5
id: mount-6
type: mount
- device: disk-sda
size: 1.5G
wipe: superblock
number: 7
preserve: false
grub_device: false
offset: 48372908032
path: /dev/sda7
id: partition-6
type: partition
- fstype: ext4
volume: partition-6
preserve: false
id: format-6
type: format
- path: /hriSafe
device: format-6
id: mount-7
type: mount
- device: disk-sda
size: 1.5G
wipe: superblock
number: 8
preserve: false
grub_device: false
offset: 49983520768
path: /dev/sda8
id: partition-7
type: partition
- fstype: ext4
volume: partition-7
preserve: false
id: format-7
type: format
- path: /hriBack
device: format-7
id: mount-8
type: mount
- device: disk-sda
size: 1.5G
wipe: superblock
number: 9
preserve: false
grub_device: false
offset: 51594133504
path: /dev/sda9
id: partition-8
type: partition
- fstype: ext4
volume: partition-8
preserve: false
id: format-8
type: format
- path: /hrifs
device: format-8
id: mount-9
type: mount
- device: disk-sda
size: 15G
wipe: superblock
number: 10
preserve: false
grub_device: false
offset: 53204746240
path: /dev/sda10
id: partition-9
type: partition
- fstype: ext4
volume: partition-9
preserve: false
id: format-9
type: format
- path: /hriData
device: format-9
id: mount-10
type: mount
- device: disk-sda
size: -1
wipe: superblock
number: 11
preserve: false
grub_device: false
offset: 69310873600
path: /dev/sda11
id: partition-10
type: partition
- fstype: ext4
volume: partition-10
preserve: false
id: format-10
type: format
- path: /hriVCR
device: format-10
id: mount-11
type: mount
- path: /boot/efi
device: format-0
id: mount-1
type: mount
- ptable: gpt
path: /dev/sdb
preserve: true
name: ''
grub_device: false
id: disk-sdb
type: disk
- device: disk-sdb
flag: linux
number: 1
preserve: true
grub_device: false
offset: 1048576
path: /dev/sdb1
id: partition-sdb1
type: partition
- fstype: ext4
volume: partition-sdb1
preserve: true
id: format-11
type: format
- path: /hriVCR2
device: format-11
id: mount-12
type: mount
swap:
size: 0
updates: security
version: 1
代码: 全选
set timeout=30
loadfont unicode
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
menuentry "Install Ubuntu22.04.05 Server for HriISP" {
set gfxpayload=keep
linux /casper/vmlinuz autoinstall ds=nocloud\;s=/cdrom/server/ ---
initrd /casper/initrd
}

1.不能实现自动安装,还是会进入到语言、等引导设置过程;
2.移除 storage 部分的配置后,能自动安装完成,但这样就失去了自动安装的意义。