<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DevMemo – installation</title><link>https://devmemo.gitlab.io/tags/installation/</link><description>Recent content in installation on DevMemo</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Mon, 06 Feb 2023 15:10:26 -0800</lastBuildDate><atom:link href="https://devmemo.gitlab.io/tags/installation/index.xml" rel="self" type="application/rss+xml"/><item><title>Blog: Automate Proxmox VM Creation With Cloud-Init</title><link>https://devmemo.gitlab.io/blog/automate_proxmox_vm_creation_with_cloud_init/</link><pubDate>Mon, 06 Feb 2023 15:10:26 -0800</pubDate><guid>https://devmemo.gitlab.io/blog/automate_proxmox_vm_creation_with_cloud_init/</guid><description>
&lt;p>This post gives you step-by-step instructions of how to automate proxmox VM creation. I&amp;rsquo;ll use ubuntu as an example.&lt;/p>
&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>The overall strategy is to use the &lt;a href="https://cloud-images.ubuntu.com/">ubuntu cloud image&lt;/a> to create a Proxmox VM template, and attach a cloud-init disk to it. After that, we can clone the template to create new VM, and new VM will automatically bootstrap itself, e.g., changing the hostname.&lt;/p>
&lt;h2 id="prepare-tools">Prepare tools&lt;/h2>
&lt;p>Install &lt;code>virt-customize&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>apt-get install libguestfs-tools
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="prepare-the-ubuntu-cloud-image">Prepare The Ubuntu Cloud Image&lt;/h2>
&lt;p>Use the following commands to prepare the ubuntu cloud image:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a new directory for our image building.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir ubuntu-cloud-image
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd ubuntu-cloud-image
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Download the cloud image.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Resize the image to 16GB. Feel free to change it to your desired size.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qemu-img resize noble-server-cloudimg-amd64.img 16G
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install avahi-deamon for mdns.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>virt-customize -a noble-server-cloudimg-amd64.img --run-command &lt;span style="color:#e6db74">&amp;#39;apt update &amp;amp;&amp;amp; apt install avahi-daemon -y &amp;amp;&amp;amp; cloud-init clean --logs --machine-id --configs all --reboot &amp;amp;&amp;amp; sudo truncate -s 0 /etc/machine-id /var/lib/dbus/machine-id&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="prepare-the-proxmox-vm-template">Prepare The Proxmox VM Template&lt;/h2>
&lt;p>Then, we prepare the Proxmox VM template with the following steps.&lt;/p>
&lt;h3 id="create-a-temporary-vm">Create A Temporary VM&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a VM with the following configuration:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># * vmid: 1000 (feel free to change this)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># * memory: 4GB&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># * network: attached to bridge vmbr0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm create &lt;span style="color:#ae81ff">1000&lt;/span> --name ubuntu-noble-template --memory &lt;span style="color:#ae81ff">4096&lt;/span> --net0 virtio,bridge&lt;span style="color:#f92672">=&lt;/span>vmbr0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="attach-the-ubuntu-cloud-image">Attach The Ubuntu Cloud Image&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Attach the ubuntu cloud image onto the VM.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Note that here ssd is my storage name. You&amp;#39;ll need to replace it with yours.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm importdisk &lt;span style="color:#ae81ff">1000&lt;/span> noble-server-cloudimg-amd64.img ssd
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Make the attached disk scsi0.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm set &lt;span style="color:#ae81ff">1000&lt;/span> --scsihw virtio-scsi-pci --scsi0 ssd:vm-1000-disk-0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Set scsi0 as the first boot device.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm set &lt;span style="color:#ae81ff">1000&lt;/span> --boot c --bootdisk scsi0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="create-a-cloud-init-drive">Create A Cloud-init Drive&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a cloud-init drive.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm set &lt;span style="color:#ae81ff">1000&lt;/span> --ide2 ssd:cloudinit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Configure your cloud-init drive. Replace the username, password and sshkeys for your case.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm set &lt;span style="color:#ae81ff">1000&lt;/span> --ciuser swe --cipassword swe-passwd --sshkeys ~/.ssh/id_rsa.pub --ipconfig0 ip&lt;span style="color:#f92672">=&lt;/span>dhcp
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="convert-the-vm-into-a-template">Convert The VM Into A Template&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Convert the VM into a template.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm template &lt;span style="color:#ae81ff">1000&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="create-vm">Create VM&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a VM using the template, and set the name to ubuntu-vm1.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm clone &lt;span style="color:#ae81ff">1000&lt;/span> &lt;span style="color:#ae81ff">1101&lt;/span> --full --name ubuntu-vm1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create another VM using the template, and set the name to ubuntu-vm2.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>qm clone &lt;span style="color:#ae81ff">1000&lt;/span> &lt;span style="color:#ae81ff">1102&lt;/span> --full --name ubuntu-vm2
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>To access these VMs, you can do&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Use the following command to access ubuntu-vm1 if you have mdns included in your template, and you are within the same LAN as ubuntu-vm1.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh swe@ubuntu-vm1.local
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Use the following command to access ubuntu-vm2 if you have mdns included in your template, and you are within the same LAN as ubuntu-vm2.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh swe@ubuntu-vm2.local
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Blog: Automate Ubuntu Installation</title><link>https://devmemo.gitlab.io/blog/automate_ubuntu_installation/</link><pubDate>Wed, 01 Feb 2023 16:22:53 -0800</pubDate><guid>https://devmemo.gitlab.io/blog/automate_ubuntu_installation/</guid><description>
&lt;p>As a software engineer, I frequently needed to create new Linux VMs for testing and other purposes. The traditional way of installing Linux on a VM is very inefficient, which consumes a lot of my time. Automating the process is very appealing to me.&lt;/p>
&lt;p>In this post, I&amp;rsquo;m going to give you step-by-step instructions of how to do that.&lt;/p>
&lt;h2 id="build-ubuntu-auto-install-iso-image">Build Ubuntu Auto-Install Iso Image&lt;/h2>
&lt;h3 id="prerequisites">Prerequisites&lt;/h3>
&lt;p>To build an auto-install ubuntu image, we&amp;rsquo;ll need to install the following packages first&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>sudo apt update &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> sudo apt install p7zip wget xorriso whois
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="set-up-build-environment">Set Up Build Environment&lt;/h3>
&lt;p>Next, let&amp;rsquo;s download the latest ubuntu image from the official website. The version we are going to be using is &lt;a href="https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-live-server-amd64.iso">ubuntu 20.04&lt;/a>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Go to your home directory.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a directory for our image building process.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir ubuntu-auto-install-image-building
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd ubuntu-auto-install-image-building/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Download the latest package.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>wget https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-live-server-amd64.iso
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a source directory.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir ubuntu-iso-sources
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Unpack the iso to the ubuntu-iso-sources dir.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>7z -y x ubuntu-22.04.1-live-server-amd64.iso -oubuntu-iso-sources
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Go into the source directory.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd ubuntu-iso-sources
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Move BOOT directory outside, since this is not needed in the final iso.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mv &lt;span style="color:#ae81ff">\[&lt;/span>BOOT&lt;span style="color:#ae81ff">\]&lt;/span> ../BOOT
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="update-image-files">Update Image Files&lt;/h3>
&lt;p>After the source files are unpacked, let&amp;rsquo;s update some files.&lt;/p>
&lt;h4 id="create-an-grub-entry">Create An Grub Entry&lt;/h4>
&lt;p>The first file to update is the grub file, i.e., &lt;code>~/ubuntu-auto-install-image-building/ubuntu-iso-sources/boot/grub/grub.cfg&lt;/code>. We&amp;rsquo;ll need to do two things:&lt;/p>
&lt;ul>
&lt;li>Add an autoinstall entry.&lt;/li>
&lt;li>Make wait time shorter (this is optional).&lt;/li>
&lt;/ul>
&lt;p>The updated file looks like this. The highlighted lines are modified.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;display:grid;">&lt;code class="language-txt" data-lang="txt">&lt;span style="display:flex; background-color:#3c3d38">&lt;span>set timeout=5
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>loadfont unicode
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set menu_color_normal=white/black
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set menu_color_highlight=black/light-gray
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex; background-color:#3c3d38">&lt;span>menuentry &amp;#34;Autoinstall Ubuntu Server&amp;#34; {
&lt;/span>&lt;/span>&lt;span style="display:flex; background-color:#3c3d38">&lt;span> set gfxpayload=keep
&lt;/span>&lt;/span>&lt;span style="display:flex; background-color:#3c3d38">&lt;span> linux /casper/vmlinuz quiet autoinstall ds=nocloud\;s=/cdrom/server/ ---
&lt;/span>&lt;/span>&lt;span style="display:flex; background-color:#3c3d38">&lt;span> initrd /casper/initrd
&lt;/span>&lt;/span>&lt;span style="display:flex; background-color:#3c3d38">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>menuentry &amp;#34;Try or Install Ubuntu Server&amp;#34; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> set gfxpayload=keep
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> linux /casper/vmlinuz ---
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> initrd /casper/initrd
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grub_platform
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>if [ &amp;#34;$grub_platform&amp;#34; = &amp;#34;efi&amp;#34; ]; then
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>menuentry &amp;#39;Boot from next volume&amp;#39; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> exit 1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>menuentry &amp;#39;UEFI Firmware Settings&amp;#39; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> fwsetup
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>else
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>menuentry &amp;#39;Test memory&amp;#39; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> linux16 /boot/memtest86+.bin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>fi
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="create-file-user-data">Create File user-data&lt;/h4>
&lt;p>Next, we&amp;rsquo;ll need to create a user-data file, &lt;code>~/ubuntu-auto-install-image-building/ubuntu-iso-sources/server/user-data&lt;/code>, with the following content.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#cloud-config&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">autoinstall&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">version&lt;/span>: &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">keyboard&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">layout&lt;/span>: &lt;span style="color:#ae81ff">us&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">identity&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">hostname&lt;/span>: &lt;span style="color:#ae81ff">ubuntu-server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">password&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;$y$j9T$qiKEYsg5oLCDV.XxExdEB/$41TEJJWV7he/aTyHQEDAWJyfKceDtCYVk.Agh9aAvk3&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">username&lt;/span>: &lt;span style="color:#ae81ff">swe&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">ssh&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">allow-pw&lt;/span>: &lt;span style="color:#66d9ef">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">install-server&lt;/span>: &lt;span style="color:#66d9ef">true&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This is a minimum setup, which only creates a user with a password. The password is &lt;code>devmemo-passwd&lt;/code>. The password string above is generated using the following command&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mkpasswd &lt;span style="color:#e6db74">&amp;#34;devmemo-passwd&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;blockquote>
&lt;p>Note that the above config is really a minimum one. Check out &lt;a href="https://ubuntu.com/server/docs/install/autoinstall-reference">this page&lt;/a> if you need more configurations.&lt;/p>
&lt;/blockquote>
&lt;h4 id="create-file-meta-data">Create File meta-data&lt;/h4>
&lt;p>For our use case, we don&amp;rsquo;t need any data in meta-data file. So we&amp;rsquo;ll just need to create an empty file.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>touch ~/ubuntu-auto-install-image-building/ubuntu-iso-sources/server/meta-data
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="create-an-auto-installation-iso-image">Create An Auto-Installation Iso Image&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create the auto-installation iso image.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>xorriso -as mkisofs -r &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -V &lt;span style="color:#e6db74">&amp;#39;Ubuntu 22.04 LTS (Auto Install)&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -o ../ubuntu-22.04-autoinstall.iso &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --grub2-mbr ../BOOT/1-Boot-NoEmul.img &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -partition_offset &lt;span style="color:#ae81ff">16&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --mbr-force-bootable &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -append_partition &lt;span style="color:#ae81ff">2&lt;/span> 28732ac11ff8d211ba4b00a0c93ec93b ../BOOT/2-Boot-NoEmul.img &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -appended_part_as_gpt &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -c &lt;span style="color:#e6db74">&amp;#39;/boot.catalog&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -b &lt;span style="color:#e6db74">&amp;#39;/boot/grub/i386-pc/eltorito.img&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -no-emul-boot -boot-load-size &lt;span style="color:#ae81ff">4&lt;/span> -boot-info-table --grub2-boot-info &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -eltorito-alt-boot &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -e &lt;span style="color:#e6db74">&amp;#39;--interval:appended_partition_2:::&amp;#39;&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> -no-emul-boot .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Check out the image.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd ..
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ls -alh ubuntu-22.04-autoinstall.iso
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now the ubuntu auto-install image is created. You can use it to auto install ubuntu on physical machines or VMs.&lt;/p>
&lt;h2 id="create-your-vms">Create Your VMs&lt;/h2>
&lt;p>After you finish the last section, you already have an ubuntu auto-installation image. This section is totally optional.&lt;/p>
&lt;p>In this section, I&amp;rsquo;ll demonstrate how to use this image on proxmox.&lt;/p>
&lt;h3 id="upload-the-image-to-proxmox-host">Upload The Image To Proxmox Host&lt;/h3>
&lt;p>First, let&amp;rsquo;s upload the image to the VM host. You can either use the web UI, or directly copy the iso into &lt;code>/var/lib/vz/template/iso&lt;/code>.&lt;/p>
&lt;h3 id="create-a-vm">Create A VM&lt;/h3>
&lt;p>Next, let&amp;rsquo;s create a VM, put the iso into its cdrom, and make the cdrom the boot device.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>qm create &lt;span style="color:#ae81ff">1000&lt;/span> --name vm1000 --cores &lt;span style="color:#ae81ff">4&lt;/span> --memory &lt;span style="color:#ae81ff">8192&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --scsi0 file&lt;span style="color:#f92672">=&lt;/span>ssd:32 --net0 virtio,bridge&lt;span style="color:#f92672">=&lt;/span>vmbr0 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span> --cdrom local:iso/ubuntu-22.04-autoinstall.iso
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For example, the above command will create a 4 core, 8GB ram, and 32GB ssd VM. Start the VM, and then all you have to do is to wait until the OS is fully installed.&lt;/p></description></item></channel></rss>