首页交流分享ubuntu22.04.05 U盘全自动安装--镜像修改

ubuntu22.04.05 U盘全自动安装--镜像修改

时间2024-10-21 09:48:53发布caterwang分类交流分享 评论1浏览115
  • 工具准备

    UltraISO

  • 文件准备

    UltraISO 工具打开 原始 iso文件

    1. 修改文件 .\boot\grub\grub.cfg

set timeout=30
loadfont unicode
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
menuentry "Install Ubuntu22.04.05 Server" {
    set gfxpayload=keep
    linux    /casper/vmlinuz quiet autoinstall ds=nocloud\;s=/cdrom/server/  ---
    initrd    /casper/initrd
}

其中,“/cdrom”表示U盘根目录。

微信截图_20241021110632.png

    2.新建文件夹  .\server

微信截图_20241021110036.png


    3.在 server 下放入两个文件 meta-data,user-data,其中 meta-data 是一个空的文本文件

微信截图_20241021110749.png

    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$S3u6D1lhO.8QlM2/$8YEiff2RMqZ18piHPS.1dT3Ic1OK4dFn6x4DablerJrrQCul/Ny7ZlpqNnygyNRIrGTs7pLEzVcyh30idJ.c7.
    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
      enp3s0:
        addresses:
        - 192.168.0.153/24
        nameservers:
          addresses: []
          search: []          
    version: 2
  oem:
    install: auto
  source:
    id: ubuntu-server
    search_drivers: false
  ssh:
    allow-pw: true
    authorized-keys: []
    install-server: true
  shutdown: poweroff
  storage:
    config:
    - id: disk-sda
      type: disk
      ptable: gpt
      wipe: superblock-recursive
      preserve: false
      grub_device: false
      path: /dev/sda
      
    - id: disk-sda-part1
      type: partition
      device: disk-sda
      number: 1
      offset: 1048576
      size: 1.5G
      wipe: superblock
      flag: boot
      preserve: false
      grub_device: true
    - id: disk-sda-part1-fs
      type: format
      fstype: fat32
      volume: disk-sda-part1
    - id: disk-sda-part1-fs-mount
      type: mount
      path: /boot/efi
      device: disk-sda-part1-fs
      
    - id: disk-sda-part2
      type: partition
      device: disk-sda
      number: 2
      size: 1G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part2-fs
      type: format
      fstype: ext4
      volume: disk-sda-part2
    - id: disk-sda-part2-fs-mount
      type: mount
      path: /boot
      device: disk-sda-part2-fs
     
    - id: disk-sda-part3
      type: partition
      device: disk-sda
      number: 3
      size: 8G
      wipe: superblock
      flag: swap
      preserve: false
      grub_device: false
    - id: disk-sda-part3-fs
      type: format
      fstype: swap
      volume: disk-sda-part3
    - id: disk-sda-part3-fs-mount
      type: mount
      path: ''
      device: disk-sda-part3-fs
      
    - id: disk-sda-part4
      type: partition
      device: disk-sda
      number: 4
      size: 25G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part4-fs
      type: format
      fstype: ext4
      volume: disk-sda-part4
    - id: disk-sda-part4-fs-mount
      type: mount
      path: /
      device: disk-sda-part4-fs
      
    - id: disk-sda-part5
      type: partition
      device: disk-sda
      number: 5
      size: 3G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part5-fs
      type: format
      fstype: ext4
      volume: disk-sda-part5
    - id: disk-sda-part5-fs-mount
      type: mount
      path: /tmp
      device: disk-sda-part5-fs
      
    - id: disk-sda-part6
      type: partition
      device: disk-sda
      number: 6
      size: 5G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part6-fs
      type: format
      fstype: ext4
      volume: disk-sda-part6
    - id: disk-sda-part6-fs-mount
      type: mount
      path: /var
      device: disk-sda-part6-fs

    - id: disk-sda-part7
      type: partition
      device: disk-sda
      number: 7
      size: 1G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part7-fs
      type: format
      fstype: ext4
      volume: disk-sda-part7
    - id: disk-sda-part7-fs-mount
      type: mount
      path: /hriSafe
      device: disk-sda-part7-fs

    - id: disk-sda-part8
      type: partition
      device: disk-sda
      number: 8
      size: 5G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part8-fs
      type: format
      fstype: ext4
      volume: disk-sda-part8
    - id: disk-sda-part8-fs-mount
      type: mount
      path: /hriBack
      device: disk-sda-part8-fs

    - id: disk-sda-part9
      type: partition
      device: disk-sda
      number: 9
      size: 1.5G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part9-fs
      type: format
      fstype: ext4
      volume: disk-sda-part9
    - id: disk-sda-part9-fs-mount
      type: mount
      path: /hrifs
      device: disk-sda-part9-fs

    - id: disk-sda-part10
      type: partition
      device: disk-sda
      number: 10
      size: 15G
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part10-fs
      type: format
      fstype: ext4
      volume: disk-sda-part10
    - id: disk-sda-part10-fs-mount
      type: mount
      path: /hriData
      device: disk-sda-part10-fs

    - id: disk-sda-part11
      type: partition
      device: disk-sda
      number: 11
      size: -1
      wipe: superblock
      preserve: false
      grub_device: false
    - id: disk-sda-part11-fs
      type: format
      fstype: ext4
      volume: disk-sda-part11
    - id: disk-sda-part11-fs-mount
      type: mount
      path: /hriVCR
      device: disk-sda-part11-fs

    - id: disk-sdb
      type: disk
      ptable: gpt
      wipe: superblock-recursive
      preserve: false
      grub_device: false
      path: /dev/sdb 

    - id: disk-sdb-part1
      type: partition
      device: disk-sdb
      number: 1
      size: -1
      wipe: superblock
      flag: linux
      preserve: false
      grub_device: false
    - id: disk-sdb-part1-fs
      type: format
      fstype: ext4
      volume: disk-sdb-part1
    - id: disk-sdb-part1-fs-mount
      type: mount
      path: /hriVCR2
      device: disk-sdb-part1-fs

  updates: security
  version: 1


其中 storage 部分可以参考 ubuntu22.04.05 U盘全自动安装--硬盘分区方法-交流分享-凯特网


  • 保存ISO文件,然后刻录到U盘即可


凯特网版权声明:以上内容允许转载,但请注明出处,谢谢!

展开全文READ MORE
ubuntu无人值守autoinstall
ubuntu22.04.05 U盘全自动安装--硬盘分区方法

游客 回复需填写必要信息
caterwang
又发现一个问题,用这个配置时,不能接网线刷机
caterwang2024-10-22 10:08:23回复