OPERATING SYSTEMSOS Linux

Proxmox VE – How to build an Ubuntu 22.04 Template (Updated Method)



Proxmox Virtual Environment is a powerful and easy to use virtualization platform with many features. Virtual machine templates help to minimize the amount of time spent building new instances, and in this video we’ll take a look at how you can utilize Ubuntu’s cloud images to automate the process of deploying new Linux instances.

Also, be sure to check out Learn Linux TV’s full tutorial course on Proxmox Virtual Environment:
Class 01 – Getting Started: https://linux.video/pve1
Class 02 – Installation Process: https://linux.video/pve2
Class 03 – Web Console Overview: https://linux.video/pve3
Class 04 – Containers vs Virtual Machines: https://linux.video/pve4
Class 05 – Launching a Virtual Machine: https://linux.video/pve5
Class 06 – Setting up Virtual Machine Templates: https://linux.video/pve6
Class 07 – Creating Containers: https://linux.video/pve7
Class 08 – Setting up Container Templates: https://linux.video/pve8
Class 09 – User Management: https://linux.video/pve9
Class 10 – Backups and Snapshots: https://linux.video/pve10
Class 11 – Integrated Firewall: https://linux.video/pve11
Class 12 – Command-line Interface: https://linux.video/pve12
Class 13 – Networking: https://linux.video/pve13
Class 14 – Shared storage: https://linux.video/pve14
Class 15 – Clustering: https://linux.video/pve15
Class 16 – High availability: https://linux.video/pve16
Bonus video 1 – Launching a Windows VM: https://linux.video/pve-win
Bonus video 2 – Getting started with Proxmox Backup Server: https://linux.video/pbs
Bonus video 3 – Proxmox VE – How to build an Ubuntu 22.04 Template (Updated Method): https://linux.video/pve-2204
Bonus video 4 – Build a Kubernetes Cluster on Proxmox: https://linux.video/proxmox-k8s

VIDEO-SPECIFIC LINKS
Ubuntu 22.04 “Jammy Jellyfish” minimal cloud image download page ➜ https://cloud-images.ubuntu.com/minimal/releases/jammy/release/
Official blog post for this video ➜ https://www.learnlinux.tv/?p=2015
Proxmox Import And Use Cloud Images ➜ https://codingpackets.com/blog/proxmox-import-and-use-cloud-images/

Check out Mastering Ubuntu Server 4th Edition (royalties earned):
– Print and e-book copies available ➜ http://ubuntuserverbook.com

*Support Linux Learning (commission earned)*
• Become a channel member here on YouTube ➜ https://learnlinux.link/join
• Become a Patron on Patreon ➜ https://learnlinux.link/patron
• Receive a 5% discount on an LPI exam voucher ➜ https://learnlinux.link/lpi-voucher
• Set up your own cloud server with Akamai Connected Cloud ➜ https://learnlinux.link/akamai

*Linux-related Gifts*
• Mastering Ubuntu Server 4th Edition (Jay wrote that!!! 😲) ➜ http://ubuntuserverbook.com
• Affiliate store for Linux compatible hardware/accessories ➜ https://learnlinux.link/amazon
• Awesome KVM for your Homelab ➜ https://learnlinux.link/tinypilot

LEARN SOMETHING NEW
– How to create a bootable flash drive for installing Linux ➜ https://linux.video/flash-usb
– Understanding Linux permissions ➜ https://linux.video/perms
– OpenSSH Guide ➜ https://linux.video/ssh
– LVM Deep-dive ➜ https://linux.video/lvm
– How to better secure OpenSSH ➜ https://linux.video/secure-ssh

*Official Learn Linux TV Sites*
• Main site ➜ https://www.learnlinux.tv
• Community ➜ https://community.learnlinux.tv

*FAQ*
• Which distro do I use? ➜ https://learnlinux.link/mydistro
• My recording gear (commissions earned) ➜ https://learnlinux.link/recording-stuff

Disclaimer: LearnLinuxTV provides technical content on YouTube that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). LearnLinuxTV is not responsible for any damages that may arise from any use of this content. The viewer is expected to follow best judgement and to make his/her/their best decisions while working with production or non-production systems and hardware.

#Proxmox #Ubuntu #DevOps

source
ubuntu

33 thoughts on “Proxmox VE – How to build an Ubuntu 22.04 Template (Updated Method)

  • Linux n00bie. I've tried this 3 times and I always end up with vms that get stuck on "starting serial terminal on interface <interface>". This doesn't happen all the time, the first time it was because of my network settings, but now it's just intermittent and I can't figure out why. Any pointers on where to look?

  • Seems that downside with this approach that installing custom things won't be part of the template? Such as the Qemu agent, and any other default packages you want setup in the template. Any way to solve that with this method, or follow the old video?

  • Perfect explanation.

    Can I install qemu agent on template itself ?
    Can I regenerate cloud image on new template based machine to have different user name

    Can templates also be backed up to PBS .

  • Set up with network storage by adjusting the command like 'qm importdisk 900 ubuntu-22.04.qcow2 nfsstorage' – the disk showed up as a '.raw' format but still worked flawlessly.

  • Great video Jay! Thanks 🙂 i am trying to create Ubuntu 22.04 Template but i don't understand when you add the ssh key to it . i mean where you get the ssh key ? Thanks

  • Is there another step if I don't have an ssh public key? If i try to log on from powershell I get permission denied (public key). Any help would be greatly appreciated. 🙂

  • I would like to add a little to one of the posts here in the comments, a few necessary first steps with the system image:

    1. virt-customize -a yaimage.img –install qemu-guest-agent
    2. virt-customize -a yaimage.img –run-command "sudo echo > /etc/machine-id; sudo ln -sf /etc/machine-id /var/lib/dbus/machine-id"
    …and what I do also:
    3. virt-customize -a yaimage.img –root-password password:yourpass – set root password
    4. virt-customize -a yaimage.img –timezone "Europe/Kiev" – set ya time zone
    5. virt-customize -a yaimage.img –install <package_name> – install some packages, for example qemu-guest-agent
    6. virt-edit yaimage.img /etc/cloud/cloud.cfg – system setup, for example enable root
    7. virt-edit yaimage.img /etc/ssh/sshd_config – ssh setup, for example enable password authentication and etc…

    Wsup!

  • Your are great and explain everything in detail. I like your work!

  • Your videos are always so clear. Step-by-step. Very helpful. Very much appreciate the videos you produce on YouTube!

  • Is this for all Linux distros or just for Ubuntu?

  • Nice video! Covered the basics. Now going to more advanced question: How to create customized template? Lets say I want to have a template with the qemu-guest-agent already installed instead of me going to the server and installing it manually, then how to proceed?

  • This is literally the best guidance and so well delivered. Definitely like and subscribe!

  • Hi,
    thanks for this tutorial, I have one issue please if you could help,
    I have followed the same instruction but when I typed ip a to see the @ip, I dont see it, (I have choosed DHCP in cloud-init as you did), do you know please what could be the problem ?

  • 11:30 or just read the manual
    12:22 no need, you can 'qm set 900 –scsi0 local-lvm:0,import-from=/root/ubuntu-22.04-minimal-cloudimg-amd64.img' and resize via GUI later.

  • Can you install qemu directly in the template ?
    Thanks for the video

  • Hello Jay! Great video. When I clone the template and boot the VM I get the Grub rescue prompt everytime

  • I found this useful, so I'm leaving a vapid comment to appease our algorithmic overlords.

  • qm importdisk $id /mnt/pve/pve-iso/template/iso/jammy-server-cloudimg-amd64.img pve-guests –format qcow2

  • For those that want to use machine q35 use the following command to change the cloudinit from ide2 to scsi
    qm set {VMID} –scsi1 local-lvm:cloudinit

  • If you're on MacOS, for qemu-quest-agent to work with the SSH key, I had to add a Host entry to my ~/.ssh/config file:
    Host *
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/generated_key_name

  • Hello Jay,
    first i want to thank You for great tutorial.
    But always when i setup template and using cloud-init from Proxmox (without configuring SSH public key option) i have problem to login to VM (created from template) via ssh – Permission denied (publickey) . Can you give me some advise how to do it?
    Many thanks.

  • great video, accurate instructions and work like a charm, thanks Jay

  • Hi Jay, I just noticed that the minimal image that you are working with in your tutorial is the same as the one used for the Container image. Cheers

  • I appreciate your youtube videos, and the way you explain.

    Looking at the video I found that you have more Bridges for different purposes.

    On the internet it is not explained clearly how to route traffic between these bridges to have the machines encapsulated under one bridge. There are some examples with NAT.

    Also is possible to do with VLANS instead of bridges but also is not clear.

    If you have time, it will be nice to cover this theme, because there is very little info on the net.

    Thank you very much.

  • 13:00 qemu can use qcow2 or raw filesystem images. With Raw there's now way for qemu to determine it's actually format because there's not file header say "This is disk image" it just has to guess. (A raw file image could be completely blank). If you pass raw direclty to qemu it'll give a warning say you should use the format=raw option to avoid issues.
    With the file extension qemu assumes it's a qcow2 image. It could guess based on filestrcture if it's qcow2 file anyway, it's very unlinkly it could be a raw image with data that looks like qcow2 anwyay.

  • the reason why you have to add a Cloudinit Drive CD-ROM to vm is because the custom cloud-init config will be "burned" to this CD-ROM, so when the attached vm is being started, the cloud-init inside of it can detect the corresponding filesystem (with fs label `cidata` and fs type `iso9660`) the CD-ROM provides, you can observe the `mount and umount of /dev/sr0 (which is cloud-init drive CD-ROM)` behaviour within /var/log/cloud-init.log, hopefully this helps!

  • i have kvm running raw and cloudinit installs the qemu agent as part of update to cloudimage. – can proxmox not do that

Comments are closed.