Ubuntu 20.04.3自动装机配置文件

Ubuntu 20.04.3自动装机配置文件Userdata cloud config autoinstall apt geoip true preserve sources list false primary arches amd64 uri 设置为你自己的 apt 源 arches default uri 设置自己的默认 apt 源 identity

大家好,我是讯享网,很高兴认识大家。

Userdata

#cloud-config autoinstall: apt: geoip: true preserve_sources_list: false primary: - arches: [amd64] uri: #设置为你自己的apt源 - arches: [default] uri: #设置自己的默认apt源 identity: {hostname: 替换为自己要设置的主机名, password: 设置用户密码,可以在其他的ubuntu机器上设置密码后复制/etc/shadow里的加密内容, username: 设置用户名} #此处为键盘设置 keyboard: {layout: us, toggle: null, variant: ''} #设置时区及语言格式什么的 user-data: timezone: Asia/Shanghai locale: zh_CN.UTF-8 #设置网络,可参照·netpaln的设置 network: ethernets: eth0: {dhcp4: true} eth1: {dhcp4: true} eth2: {dhcp4: true} eth3: {dhcp4: true} eth4: {dhcp4: true} eth5: {dhcp4: true} eth6: {dhcp4: true} eth7: {dhcp4: true} version: 2 #是否安装ssh,建议安装 ssh: allow-pw: true authorized-keys: [] install-server: true #配置你的硬盘,此处为设置了vg的 storage: config: - {ptable: gpt, path: /dev/sda, wipe: superblock-recursive, preserve: false, name: '', grub_device: true, type: disk, id: disk-sda} - {device: disk-sda, size: , flag: bios_grub, number: 1, preserve: false, grub_device: false, type: partition, id: partition-sda1} - {device: disk-sda, size: , wipe: superblock, flag: linux, number: 2, preserve: false, grub_device: false, type: partition, id: partition-sda2} - {fstype: ext4, volume: partition-sda2, preserve: false, type: format, id: format-0} - {device: disk-sda, size: -1, wipe: superblock, flag: linux, number: 3, preserve: false, grub_device: false, type: partition, id: partition-sda3} - name: VolGroup00 devices: [partition-sda3] preserve: false type: lvm_volgroup id: lvm_volgroup-0 - {name: LogVol00, volgroup: lvm_volgroup-0, size: 0B, preserve: false, type: lvm_partition, id: lvm_partition-0} - {fstype: ext4, volume: lvm_partition-0, preserve: false, type: format, id: format-1} - {device: format-1, path: /, type: mount, id: mount-1} - {name: swap, volgroup: lvm_volgroup-0, size: B, preserve: false, type: lvm_partition, id: lvm_partition-1} - {fstype: swap, volume: lvm_partition-1, preserve: false, type: format, id: format-2} - {device: format-2, path: '', type: mount, id: mount-2} - {name: LogVol02, volgroup: lvm_volgroup-0, size: B, preserve: false, type: lvm_partition, id: lvm_partition-2} - {fstype: ext4, volume: lvm_partition-2, preserve: false, type: format, id: format-3} - {device: format-3, path: /tmp, type: mount, id: mount-3} - {name: LogVol01, volgroup: lvm_volgroup-0, size: 0B, preserve: false, type: lvm_partition, id: lvm_partition-3} - {fstype: ext4, volume: lvm_partition-3, preserve: false, type: format, id: format-4} - {device: format-4, path: /var, type: mount, id: mount-4} - {name: LogVol03, volgroup: lvm_volgroup-0, size: -1, preserve: false, type: lvm_partition, id: lvm_partition-4} - {fstype: ext4, volume: lvm_partition-4, preserve: false, type: format, id: format-5} - {device: format-5, path: /da1, type: mount, id: mount-5} - {device: format-0, path: /boot, type: mount, id: mount-0} swap: {swap: 0} version: 1 #此处为安装后执行的命令 late-commands: - curtin in-target --target=/target -- update-grub2 - curtin in-target --target=/target -- apt-get -y update - curtin in-target --target=/target -- apt-get -y install freeipa-client resolvconf

讯享网

最后的late-commands,执行时需要注意路径,因为此时的系统安装位置为/target下,例如sed一个文件的内容,该文件在root目录下需要执行为sed -i 's/内容1/内容2/' /target/root/文件名

参考文章:


讯享网

Automated server install reference | Ubuntu

https://askubuntu.com/questions//deploy-ubuntu-20-04-on-bare-metal-or-virtualbox-vm-by-pxelinux-cloud-init-doesn
Storage — curtin 21.3 documentation
 

小讯
上一篇 2025-02-10 16:20
下一篇 2025-04-03 12:52

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/28109.html