{"id":568,"date":"2025-08-07T12:07:44","date_gmt":"2025-08-07T04:07:44","guid":{"rendered":"https:\/\/windywind.tk\/?p=568"},"modified":"2025-08-07T13:35:51","modified_gmt":"2025-08-07T05:35:51","slug":"%e5%88%b6%e4%bd%9cubuntu-server-24-04-autoinstall-iso%e9%95%9c%e5%83%8f","status":"publish","type":"post","link":"https:\/\/windywind.tk\/?p=568","title":{"rendered":"\u5236\u4f5cUbuntu Server 24.04 Autoinstall ISO\u955c\u50cf"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><mark style=\"background-color:#fcb900\" class=\"has-inline-color\"><strong>\u4ec5\u9488\u5bf9Ubuntu Server\uff0c\u800c\u975eUbuntu Desktop<\/strong><\/mark><\/p>\n<\/blockquote>\n\n\n\n<p>\u81eaUbuntu 20.04\u5f00\u59cb\uff0c\u81ea\u52a8\u5b89\u88c5\u90e8\u7f72\u5c06\u4f7f\u7528subiquity\u7684user-data\u65b9\u5f0f\uff0c\u4e0d\u518d\u652f\u630118.04\u548c\u66f4\u65e9\u7248\u672c\u7684pre-seed\u3002<\/p>\n\n\n\n<p>Autoinstall\u7684\u2018user-data\u2019\u552f\u4e00\u5b98\u65b9\u53c2\u8003\u662f<a href=\"https:\/\/ubuntu.com\/server\/docs\/install\/autoinstall-reference\">https:\/\/ubuntu.com\/server\/docs\/install\/autoinstall-reference<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u51c6\u5907\u5de5\u4f5c<\/h1>\n\n\n\n<p>\u5236\u4f5c\u524d\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u5de5\u5177<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>7z \u2014\u2014\u7528\u4e8e\u89e3\u538b\u5b98\u65b9ISO\uff08\u5305\u62ecMBR\u548cEFI\u5206\u533a\uff09 <br><code>sudo apt install p7zip<\/code><\/li>\n\n\n\n<li>xorriso\u2014\u2014\u7528\u4e8e\u6784\u5efa\u4fee\u6539\u540e\u7684ISO <br><code>sudo apt install xorriso<\/code><\/li>\n<\/ol>\n\n\n\n<h1 class=\"wp-block-heading\">\u51c6\u5907\u73af\u5883<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir source-files\ncp &lt;path_to&gt;\/ubuntu-24.04.2-live-server-amd64.iso ubuntu-24.04.2-live-server-amd64.iso<\/code><\/pre>\n\n\n\n<p>\u89e3\u538b\u955c\u50cf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><kbd>7z -y x ubuntu-24.04.2-live-server-amd64.iso -osource-files<\/kbd><\/code><\/pre>\n\n\n\n<p>source-files\u76ee\u5f55\u4e2d\u4f1a\u6709\u4e00\u4e2a \u2018[BOOT]\u2019\uff0c\u5305\u542b\u4e86 <code>1-Boot-NoEmul.img <\/code><code>2-Boot-NoEmul.img<\/code><\/p>\n\n\n\n<p>\u8fd9\u4e24\u4e2a\u5c31\u662fMBR\u5f15\u5bfc\u548cEFI\u5f15\u5bfc\u5206\u533a\u7684\u955c\u50cf\u3002\u6211\u4eec\u4e0d\u9700\u8981\u628a\u5b83\u4eec\u6253\u5305\u8fdbISO\uff0c\u6240\u4ee5\u628a\u5b83\u4eec\u79fb\u5230\u4e0a\u5c42\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><kbd>mv  '&#91;BOOT]' ..\/BOOT<\/kbd><\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u7f16\u8f91grub.cfg<\/h1>\n\n\n\n<p>\u7f16\u8f91 <code>boot\/grub\/grub.cfg<\/code><\/p>\n\n\n\n<p>\u5728\u6240\u6709menuentry\u524d\u6dfb\u52a0\u4e00\u5757menuentry\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><kbd>menuentry \"Autoinstall Ubuntu Server\" {\n        set gfxpayload=keep\n        linux   \/casper\/vmlinuz quiet autoinstall ds=nocloud\\;s=\/cdrom\/nocloud\/  ---\n        initrd  \/casper\/initrd\n}<\/kbd><\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u7406\u89e3\u4e3a\u590d\u5236\u4e86&#8221;Try or Install Ubuntu Server&#8221;\u8fd9\u4e2amenuentry\uff0c\u5e76\u5728linux\u884c\u589e\u52a0\u4e86autoinstall\u3002\u6307\u5b9a\u4e86ds (data source\uff09\u4e3anocloud\uff0csource\u8def\u5f84\u4e3a\/cdrom\/nocloud\/\u3002\u6ce8\u610f\u9700\u8981\\\uff08\u53cd\u659c\u6760\uff09\u6765\u8f6c\u4e49\uff0c\u4ee5\u4fdd\u7559;\uff08\u5206\u53f7\uff09\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u53ef\u80fd\u4f1a\u5f97\u5230\u50cf\u4e0b\u56fe\u6240\u793a\u7684\u7ed3\u6784<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/226ae3d9-17be-4e5b-a164-9426252d5051.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"364\" src=\"https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/226ae3d9-17be-4e5b-a164-9426252d5051-1024x364.png\" alt=\"\" class=\"wp-image-571\" srcset=\"https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/226ae3d9-17be-4e5b-a164-9426252d5051-1024x364.png 1024w, https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/226ae3d9-17be-4e5b-a164-9426252d5051-300x107.png 300w, https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/226ae3d9-17be-4e5b-a164-9426252d5051-768x273.png 768w, https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/226ae3d9-17be-4e5b-a164-9426252d5051.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u51c6\u5907autoinstall\u7528\u5230\u7684\u6587\u4ef6<\/h1>\n\n\n\n<p>\u521b\u5efanocloud\u76ee\u5f55\u7528\u4e8e\u5b58\u653euser-data\u548cmeta-data<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir source-files\/nocloud<\/code><\/pre>\n\n\n\n<p>\u7531\u4e8ecloud-init\u4f9d\u8d56meta-data\uff0c\u5373\u4f7f\u6211\u4eec\u7528\u4e0d\u5230\u5b83\uff0c\u4e5f\u5fc5\u987b\u8981\u521b\u5efa\u4e00\u4e2a\u7a7a\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch source-files\/nocloud\/meta-data<\/code><\/pre>\n\n\n\n<p>\u521b\u5efa\u5e76\u7f16\u8f91user-data<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim source-files\/nocloud\/user-data<\/code><\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2auser-data\u7684\u793a\u4f8b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#cloud-config\nautoinstall:\n  version: 1\n  locale: en_US.UTF-8\n  keyboard:\n    layout: us\n  identity:\n    hostname: supos-ce-edge\n    username: supos\n    password: $6$LartesJok7i1zS9a$K5K70Sf\/ZyIdPQw8fRSaHTKAfEJ1cftHurcgTAZS98IzYv\/zq64mfgg53E98rmwdy6zaTQa4W0u8hD.6hvEWn. #\u53ef\u4ee5\u7528 openssl passwd -6 YourPassword \u6765\u751f\u6210\n  ssh:\n    allow-pw: true\n    install-server: true\n  apt:\n    preserve_sources_list: true\n    geoip: true\n    fallback: offline-install\n  storage:\n    layout:\n      name: direct\n  packages:\n    - vim\n    - curl\n    - wget\n    - net-tools\n  late-commands:\n    - curtin in-target -- apt-get -y purge unattended-upgrades  #\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5378\u8f7d\u6211\u4e0d\u559c\u6b22\u7684 unattended-upgrades<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u7cfb\u7edf\u8fc7\u7a0b\u4e2d\u5b89\u88c5\u7684\u8f6f\u4ef6\u5305\u4f1a\u76f4\u63a5\u4ece\u516c\u7f51\u4e0a\u62c9\u53d6\uff08\u6682\u65f6\u6ca1\u6709\u627e\u5230\u53ef\u4ee5\u4eceISO\u672c\u5730\u76f4\u63a5\u5b89\u88c5\u7684\u65b9\u5f0f\uff09\uff0c\u6240\u4ee5\u4e0d\u5efa\u8bae\u5b89\u88c5\u592a\u591a\uff0c\u66f4\u4e0d\u5efa\u8bae\u5b89\u88c5ubunt-desktop\u8fd9\u6837\u7684\u5927\u5305\u3002\u5982\u679c\u6709\u9700\u8981\uff0c\u5efa\u8bae\u8fdb\u5165\u7cfb\u7edf\u540e\u914d\u7f6eAPT\u6e90\u518d\u5b89\u88c5\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u6784\u5efa\u4fee\u6539\u540e\u7684ISO<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>xorriso -indev ubuntu-24.04.2-live-server-amd64.iso -report_el_torito as_mkisofs<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528xorriso\u547d\u4ee4\u67e5\u770b\u539f\u955c\u50cf\u7684\u4fe1\u606f<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/8a1dd7d7-9f6d-4ccf-b4fe-096ee069a5c2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"578\" src=\"https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/8a1dd7d7-9f6d-4ccf-b4fe-096ee069a5c2-1024x578.png\" alt=\"\" class=\"wp-image-570\" srcset=\"https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/8a1dd7d7-9f6d-4ccf-b4fe-096ee069a5c2-1024x578.png 1024w, https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/8a1dd7d7-9f6d-4ccf-b4fe-096ee069a5c2-300x169.png 300w, https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/8a1dd7d7-9f6d-4ccf-b4fe-096ee069a5c2-768x434.png 768w, https:\/\/windywind.tk\/wp-content\/uploads\/2025\/08\/8a1dd7d7-9f6d-4ccf-b4fe-096ee069a5c2.png 1328w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>\u63d0\u53d6\u5173\u952e\u4fe1\u606f\uff0c\u5e76\u66ff\u6362\u5230\u4ee5\u4e0b\u547d\u4ee4\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd source-files\n\nxorriso -as mkisofs -r \\\n  -V 'Ubuntu Server 24.04.2 auto' \\\n  -o ..\/ubuntu-24.04.2-live-server-amd64-autoinstall.iso \\\n  --grub2-mbr ..\/BOOT\/1-Boot-NoEmul.img \\\n  -partition_offset 16 \\\n  --mbr-force-bootable \\\n  -append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b ..\/BOOT\/2-Boot-NoEmul.img \\\n  -appended_part_as_gpt \\\n  -iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \\\n  -c '\/boot.catalog' \\\n  -b '\/boot\/grub\/i386-pc\/eltorito.img' \\\n    -no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \\\n  -eltorito-alt-boot \\\n  -e '--interval:appended_partition_2:::' \\\n  -no-emul-boot \\\n  .\/<\/code><\/pre>\n\n\n\n<p>\u968f\u540e\u4f1a\u5728 source-files \u7684\u4e0a\u7ea7\u76ee\u5f55\u5f97\u5230<code>ubuntu-24.04.2-live-server-amd64-autoinstall.iso<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec5\u9488\u5bf9Ubuntu Server\uff0c\u800c\u975eUbuntu Desktop \u81eaUbuntu 20.04\u5f00\u59cb\uff0c\u81ea\u52a8\u5b89\u88c5\u90e8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-568","post","type-post","status-publish","format-standard","hentry","category-2"],"_links":{"self":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts\/568"}],"collection":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=568"}],"version-history":[{"count":3,"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts\/568\/revisions"}],"predecessor-version":[{"id":573,"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts\/568\/revisions\/573"}],"wp:attachment":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}