Create VMs on Proxmox in Seconds!

Sdílet
Vložit
  • čas přidán 16. 05. 2024
  • In this video I show you how to create VM Templates in Proxmox. We will use Packer from Hashicorp, which is a free and open-source image automation tool. This can create custom machine images for Proxmox with provisioning shell scripts and inject configuration settings via Cloud-Init. #Proxmox #Packer #Cloudinit
    My Packer Templates: github.com/christianlempa/boi...
    Teleport Tutorial: • How I secure my Server...
    Teleport-*: goteleport.com/thedigitallife
    Follow me:
    TWITTER: / christianlempa
    INSTAGRAM: / christianlempa
    DISCORD: / discord
    GITHUB: github.com/christianlempa
    PATREON: / christianlempa
    MY EQUIPMENT: kit.co/christianlempa
    Timestamps:
    00:00 - Introduction
    01:20 - What is Packer?
    03:07 - How to use Packer in Proxmox
    04:45 - Integrating Cloud-Init
    07:27 - Advertisement-*
    08:03 - Preparing the Project
    10:09 - Packer Template for Ubuntu
    16:56 - Provisioning the Ubuntu Server
    18:48 - Build the Template with Packer
    20:24 - Deploy a new VM from the Template
    21:43 - Troubleshooting and Issues
    24:01 - The next steps
    ________________
    All links with "*" are affiliate links.

Komentáře • 134

  • @mustafasinankoca6439
    @mustafasinankoca6439 Před 2 lety +6

    I discovered you recently. In general, you are explaining such nice tricks to a person who does not know the subject :) Congratulations, I wish you continued success . Bravo

    • @christianlempa
      @christianlempa  Před 2 lety

      Thank you so much! :) Makes me so happy to read this

  • @BrunoAlves-jn2tj
    @BrunoAlves-jn2tj Před 2 lety +1

    Man, you helped me a lot with some use cases for a task that I have. Thank you so much and keeping do it. Great video and very good explanation!!

  • @pouet4608
    @pouet4608 Před 6 měsíci +5

    Great video.
    Very pleasing to follow.
    Very clear:
    You ve put a framework by putting the most important principles first,
    Then putting details with why, what, steps and tools on those principles, and by linking logicaly the principles.
    Few have your redactional qualities.
    One way or another, you have to teach.

  • @KonstantinGontsov
    @KonstantinGontsov Před rokem

    Thanks! Use Proxmos around 10 years. Packer thats I need many years ago!!!

  • @MarkConstable
    @MarkConstable Před 2 lety +17

    Looking forward to a Packer + Terraform video. I'd also be interested to see how Packer (and Terraform) could work with LXD too. Proxmox is great but, as everyone knows, it requires a Debian base, whereas the snap version of LXD will run on just about any arch or distro and also provides both VM and CT instances with clustering features. It's just missing a standard web GUI like Proxmox.

  • @itsr0m_Highlights
    @itsr0m_Highlights Před 2 lety

    SO COOL! interested in how this would interact with Terraform. Thank you for the video!

  • @TheJoBlackos
    @TheJoBlackos Před 11 měsíci +2

    Hey, first of all, great video. You have packed up lots of info in this video. As a new packer user I had to deal with the plugin installation which was not a part of the video but I can understand that we cannot go over everything and we need to make hard choices in order to simplify the content. For those who had error messages about unknown source, you need to define the plugin to be used and then initialize packer in order to install that plugin :)

    • @insanity.k
      @insanity.k Před 11 měsíci

      what is the needed plugin to install?

    • @TheJoBlackos
      @TheJoBlackos Před 11 měsíci

      @@insanity.k As mentioned, you can either use the proxmox-iso option to create an image from iso, or maybe the better option, create an image from virtual machine you already have using the proxmox-clone

    • @insanity.k
      @insanity.k Před 11 měsíci +3

      @@TheJoBlackos Kinda new to Packer - I want to use the proxmox-iso plugin. But how do I use that? Where do I define using the proxmox-iso plugin and how to initialize packer in order to install the plugin? Thanks in advance!

  • @DamjanKumin
    @DamjanKumin Před 2 lety +1

    Fantastic! Excellent addition to youtube 👌⭐️

  • @chfmrf9605
    @chfmrf9605 Před rokem

    Very good video! Easy to follow and important details.

  • @chrissenanayake9891
    @chrissenanayake9891 Před rokem

    This is really great content!! I am just getting started with Proxmox and this is very helpful

  • @joel-eq8tq
    @joel-eq8tq Před rokem +1

    Great tutorial. Very clear and easy to follow.

  • @ivlis32
    @ivlis32 Před rokem

    Thank you for the video, it is very educational!

  • @chrisumali9841
    @chrisumali9841 Před 2 lety

    Thanks for the demo and info, have a great day

  • @lukaspechar
    @lukaspechar Před 4 měsíci

    You sir, are a goldmine of information!!!

  • @stream2learn
    @stream2learn Před 2 lety

    Precisely what i was looking for.

  • @nikitakunaev860
    @nikitakunaev860 Před 10 měsíci

    Thanks you 4 helpful video and tutorial! Also you have a perfect pronunciation, that awesome 4 me as foreign listener! :)

  • @edwardvanhazendonk
    @edwardvanhazendonk Před 2 lety +1

    Nice, very clear instructions!

  • @murtadha96
    @murtadha96 Před 3 měsíci

    This was a great video btw! Many thanks for the high level explanation

  • @MrNoBSgiven
    @MrNoBSgiven Před 2 lety

    Christian. Excellet video again. Tomorrow, I will go and follow your next video in the series - Terraform with Proxmox VM creation (cloning). Thanks.

  • @tyr747148
    @tyr747148 Před měsícem

    Amazing Video, as always 👏🏼

  • @peterge98
    @peterge98 Před 10 měsíci

    Awesome, this worked for me!

  • @holyproton8855
    @holyproton8855 Před rokem

    Thanks for your video!
    Does the SSH users need to exist in order to build the VM or will packer create that? I assume it needs to be created before had to use the private SSH key.
    Also how would I enable cloud-init on proxmox?

  • @nathanielmoore87
    @nathanielmoore87 Před 2 lety +3

    I just watched @Techno Tim's video on this very topic. So cool to get 2 different perspectives on the same topic within literally days of each other. Thank you!! 😁

    • @christianlempa
      @christianlempa  Před 2 lety +2

      Oh yeah I watching his video as well and was so glad that I did it slightly different 😁

  • @scockman
    @scockman Před 2 lety +3

    Another AWESOME video! I got my two templates up and running after a few tries. One thing on the docker one is that also added docker-compose as well. Now with the release of Ubuntu 22.04 LTS, I thought that I could just clone the scripts - change names, etc. and it would work. To my sad surprise, it would appear that boot commands between 20.04 and 22.04 are different. Will have to try and dig in and find out what they are.

    • @christianlempa
      @christianlempa  Před 2 lety +2

      Currently working on this, you should see an update on my GitHub Repo soon!

    • @m19v
      @m19v Před 26 dny

      Hi@@christianlempa , facing similar issue. Autoinstall stuck on language selection with Ubuntu 22.04.4. Your boilerplate scripts refer to Ubuntu 22.04 which is can not be downloaded. Thanks!

  • @DrDingus
    @DrDingus Před 7 měsíci

    Does this apply to LXC containers as well? I'm almost 100% lXC on Proxmox.

  • @Spydaw
    @Spydaw Před 2 lety +1

    Yeah, awesome video, thanks for sharing ;)

    • @christianlempa
      @christianlempa  Před 2 lety +2

      Thank you so much for your help! 🥰

    • @Spydaw
      @Spydaw Před 2 lety

      @@christianlempa You are most welcome, anytime.

  • @AndreasLenze
    @AndreasLenze Před 2 lety

    Brilliant - again! 👍

  • @KowshikRaja-jr9rd
    @KowshikRaja-jr9rd Před rokem

    Can I use it in Virtual box or VMware the proxmox installation what u recommend and how to remove the pre-build tools in linux and making to install own tools

  • @dikshitakalita1207
    @dikshitakalita1207 Před 2 lety +1

    Hey TheDigitalLife! Your Videos are very thorough and to the point. I followerd your Traefik Video and it provided me very good concepts. Could you also make another Video on Ingress in k8s and how we could secure it both in ipv4 and ipv6 address?

    • @christianlempa
      @christianlempa  Před 2 lety

      Thanks! Glad that you enjoy the videos :) I currently have no plans to do this, but maybe we will discuss ipv6 in a future video

  • @johndan4986
    @johndan4986 Před 2 lety

    Thanks for the great video. Please i need some help on how i can passthrough my h710min hba pcie card to my truenas vm in proxmox. I have a dell r720xd server.

  • @declanmcardle
    @declanmcardle Před 9 měsíci

    @23:40 is there a lint function for the .yaml file?

  • @eoeoeovideos
    @eoeoeovideos Před 6 měsíci

    Hello, great video!! Any idea how to do IP Pools in Proxmox because it doesn't have this option!

  • @StanyCarteny
    @StanyCarteny Před 2 lety

    spettacolare!!!

  • @DwightElliott
    @DwightElliott Před rokem

    Mind sharing an example of the environ access file? Can only find for aws.

  • @rauldeandrade
    @rauldeandrade Před rokem

    Hi Christian! Thank you so much. I learned so much from you and your videos look great.
    I followed the tutorial and everything worked as expected, but if I try to make more than one VM they share the same IP. I tried everything I could think of including one last
    provisioner "shell" {
    inline = [
    "sudo cloud-init clean",
    "sudo rm -f /etc/machine-id",
    "sudo rm -f /var/lib/dbus/machine-id"
    ]
    }
    But the IP keeps persisting. I've looked into other tutorials on cloudinit where this seems to be a consideration, but I don't know what to do in Packer

    • @JustinWallis
      @JustinWallis Před rokem +1

      Did you have a qemu-agent install fail, qcow2 unsupported format, failed to connect system bus Error?

    • @rauldeandrade
      @rauldeandrade Před rokem

      @@JustinWallis No errors unfortunately. That's why I'm having difficulty diagnosing the issue. Everything seems fine, but in the end I always get the same IP.

  • @HiltonT69
    @HiltonT69 Před 2 lety

    Really nice. :)

  • @nguyenatonio8248
    @nguyenatonio8248 Před 2 lety

    interesting, will it work with LXC or only for QEMU instance? also is Packer able to resize/change resource after instance created?

  • @eshwar.s885
    @eshwar.s885 Před 2 lety +5

    Hey for me the boot gets stuck at cloud-init running init-local in the console and the script is waiting for ssh to be accessible....would you happen to know any fix ?

    • @alexbergsland
      @alexbergsland Před rokem +1

      Ok, a bit late maybe, but check what is happening in the Proxmox console on the newly created VM. For me packer fails to unmount the ISO which means it will start the installer script again on reboot instead of booting the new server. This appears to be an unsolved bug.

    • @bsilva11
      @bsilva11 Před rokem

      I have the same problem, u remember how u resolve a issue?

  • @charleshopper4638
    @charleshopper4638 Před rokem

    Quick question: When I want to create a quick vm on my proxmox system right now, all I do is clone the existing vm and run a bash script that modifies the mac, ip and hostname. I reboot the vm, and it works like a charm and only takes a few minutes. Simple and easy. Is this a bad workflow?

  • @kevinyu9934
    @kevinyu9934 Před 2 lety

    Nice !

  • @florianrichter4180
    @florianrichter4180 Před 2 lety

    Hey, I have the problem that the VM has no internet when it hangs in the boot CMD and therefore can't reach the webserver. the dhcp server works though.

  • @knightrider6478
    @knightrider6478 Před 4 měsíci

    Hello, I tried to build a template using your tutorial but i get an error: wasm connection closed by the server ( being proxmox ) I have latest version of Proxmox. Do you have an idea?
    Thank you !
    Regards

  • @jonasaeschlimann3742
    @jonasaeschlimann3742 Před rokem

    Is it also possible to automatically distribute VMs into pools?

  • @pierretchekouteu5983
    @pierretchekouteu5983 Před rokem

    Hello
    ubuntu install in PROXMOX via packer stuck at welcome screen
    how to bypass that ?
    any help will be appreciated
    thanks

    • @artemtovkach
      @artemtovkach Před 7 měsíci

      My Packer build is stuck on the "Waiting for SSH to become available..." step, and I'm not able to log into vm. Did you solve the issue?

  • @padraigconnolly2991
    @padraigconnolly2991 Před 2 lety

    Hey! This was a great video, I ran the same install with your new 22.04 packer proxmox templates but the boot is hanging on "[ OK ] Finished Load AppArmor profiles managed internally by snapd", did you see anything like this?

    • @padraigconnolly2991
      @padraigconnolly2991 Před 2 lety

      One last thing I noticed, the 22.04 template doesn't work with ssh passwords even if the autoinstall user-data and packer hcl file have the exact same entries. It worked once I used ssh keys instead. The following was the error if you're interested:
      Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

    • @christianlempa
      @christianlempa  Před 2 lety

      Did you encode your ssh password? It needs to be base64 if I'm right

    • @padraigconnolly2991
      @padraigconnolly2991 Před rokem

      @@christianlempa Ah thats probably it, it was in raw string format, do you know the reason for base64 requirement?

  • @MehrdadGivehchi
    @MehrdadGivehchi Před 2 lety

    thanks for the video as it is very helpful...
    one question that maybe someone can help with:
    the packer automation fails when I try to use ssh password instead of public key authentication and I get the following error message:
    Packer experienced an authentication error when trying to connect via SSH
    I have googled on this issue but still unable to get past the ssh authentication. Any hint is greatly appreciated.

  • @m-electronics5977
    @m-electronics5977 Před rokem

    But why I must create an install template which I use only one time and then the machine is there. then it's a template and I don't need to install it anymore

  • @dreagnore
    @dreagnore Před rokem +1

    Are you using LVM? because I'm gettning this error " unsupported format 'qcow2' " apparently LVM doesn't support that if I set it to raw it does work but just wandering

    • @mandeepmails
      @mandeepmails Před rokem

      using "raw" instead of qcow2 would get you through. had same issue. done it today successfully

  • @softwaredeveloper9130
    @softwaredeveloper9130 Před 2 lety +2

    Hey, I just followed your example and it works (with ssh keys) however if I switch to password it fails. Did you try using password for ssh credential?

    • @MrNoBSgiven
      @MrNoBSgiven Před 2 lety

      FOUND IT! During the cloning of the image changing the user in "Cloud-Init" screen has some bug. When the user name is left empty (it will show 'Default'), cloud init will greater a new user 'ubuntu' in addition to the one specified by the packer template. The password which you change in Proxmox Cloud-Init will be assigned to .... wait for it ... to ubuntu account and not the one specified by the packer temple. This is VERY screwy indeed. I did not test if the packer defined user id in such situation will simply get no password. To late to test it tonight.

    • @artemtovkach
      @artemtovkach Před 7 měsíci

      I have the same issue. How to fix that?

  • @hotrodhunk7389
    @hotrodhunk7389 Před 8 měsíci +1

    Can't you make a vm then make a template out of it?

  • @mdiaztoledo
    @mdiaztoledo Před 2 lety

    Interesting

  • @stream2learn
    @stream2learn Před 2 lety

    Can you do a video on OPN sense firewall. As well as PFsense.

  • @2u263
    @2u263 Před 6 měsíci

    Christian Packer sounds great but it is important to know how to create vms containers & templates by hand to understand what is going on. Automation is good till it goes wrong .

  • @eduvansilva
    @eduvansilva Před 2 lety +2

    Why don't use ubuntu cloud-image instead of ubuntu image?

    • @ikanpar1
      @ikanpar1 Před rokem +1

      I am thinking exactly the same thing. Ubuntu cloud image + cloud-init can be proxmox template in less than 10 lines of commands 😁

  • @marcelomartinrossi4036

    Please I need a hand! I 'm using your git script but it Freeze in the middle of Ubuntu Installation, at mirror package selection, What can be the reason? Great video! Thanks in advance

    • @christianlempa
      @christianlempa  Před 2 lety

      I've explained some of the problems in my troubleshooting section of the video, others I really don't know. You could share some logs and infos in our Discord, maybe somebody can help.

  • @hershyreisman
    @hershyreisman Před 2 lety +1

    How do you have that proxmox skin?

  • @IvanRosaT
    @IvanRosaT Před rokem

    what if I was trying to install an image of Ubuntu that includes the GUI such Gnome?

    • @christianlempa
      @christianlempa  Před rokem

      Would also work similar way, you can put anything in your templates

    • @IvanRosaT
      @IvanRosaT Před rokem

      @@christianlempa wouldn't the Mac address and IP would replicate Every time or will it change automatically?

  • @Mr76Pontiac
    @Mr76Pontiac Před 11 měsíci

    Interesting process, but, this smells like it's a 1:1 build? I know this is a year old video, but I kinda stopped taking notes as soon as I saw a lot of inputs that are pretty static when it comes to new machine builds. Like, defining IP addresses? Assigning the VM an ID to ProxMox? What if I wanted to spin up several VMs for different purposes based on this template, this seems pretty "stuck" to how the template file is configured, and you'd have to go edit/copy the config files every time you want something different for the next VM, like the ID or static IP address, or whatever the case may be. This process just doesn't seem like it's going to save time compared to just running a base template, and copy/pasting a set of commands out.
    Am I missing something here?

    • @xultix
      @xultix Před 11 měsíci +2

      After you create the template, you can use something like terraform to automate building x amount of machines with different id's.

  • @lakshminarasimmanv
    @lakshminarasimmanv Před 2 lety +8

    I use terraform to provision VMs.

    • @christianlempa
      @christianlempa  Před 2 lety +5

      Oh yeah that's a great idea, maybe topic for a future video? 😀

  • @nbensa
    @nbensa Před 2 lety

    ooohhhh.... that dark theme for proxmox! How? Is it PVEDiscordDark? TIA!

    • @christianlempa
      @christianlempa  Před 2 lety

      Yes! ;) Got it from GitHub

    • @DJRowlee1964
      @DJRowlee1964 Před 2 lety

      @@christianlempa Just a totally off topic question :) What mixer are you using? It looks nice.

  • @bjornarsimonsen7592
    @bjornarsimonsen7592 Před rokem

    Wait, wouldn't it be faster to just spend the time to make a VM manually, keep it as a VM iinstead of converting to template and just clone it when you need another instance? By keeping it as a VM to maintain the ability to do updates and other changes. Why do a whole installation every time, even if automated, when you can just clone a "template" VM in seconds? And why cloud-init when packer seemingly is able to do all the same stuff?

    • @mrmotomoto
      @mrmotomoto Před rokem

      One example he provided was a vm with different user credentials

  • @domantlen6231
    @domantlen6231 Před 2 lety

    Honestly i prefer to use lxc with docker inside. They work better tham VMs in resource limited environments - no virtualisation overhead and much better flexibility in adjusting assigned resources. The only vm i have is pfsense. I cant afford for special virtualization licenses to vitualize other os like windows or macos. I know that some abuse trial licenses or even use keys from physical machines but their license dont allow that, so such actions are plain piracy.

  • @Rgb0braucht0keiner
    @Rgb0braucht0keiner Před 2 lety

    Grüße! Gutes Video Wäre mal schön das auch in deutsch zu hören danke

    • @christianlempa
      @christianlempa  Před 2 lety

      Ich mache zwar nicht die gleichen, aber andere Videos auf meinem deutschen Kanal. Ist mehr in Vlog und Persönlicher Kanal, aber kannst ja mal reinschauen ;) Gibts auch Informatiker Content.

    • @Rgb0braucht0keiner
      @Rgb0braucht0keiner Před 2 lety

      @@christianlempa ich finde 👍 👍 👍 gut wie du es machst weiter so

    • @christianlempa
      @christianlempa  Před 2 lety

      @@Rgb0braucht0keiner danke, mach ich 😀

  • @atom6_
    @atom6_ Před 2 lety

    Call me weird, but I run proxmox only with LXC's, waste of resources to use VM's unless there is a specific kernel/os/migration requirement.

    • @christianlempa
      @christianlempa  Před 2 lety

      Yeah why not? LXC seems like a great feature on Proxmox

  • @dalisoft
    @dalisoft Před 2 lety

    11:16 are you using Linux?

    • @christianlempa
      @christianlempa  Před 2 lety

      No I'm using Windows on my PC

    • @dalisoft
      @dalisoft Před 2 lety

      @@christianlempa cool, i did think it’s kde or gnome

  • @mariotubelecce
    @mariotubelecce Před 2 lety +5

    this is overcomplicated alternative for using a cloud init image and provision it with cloud init too?🤕

    • @christianlempa
      @christianlempa  Před 2 lety +2

      Well, you can do this manually as well, but the point was to simply that process with packer

    • @AndreaGhensi
      @AndreaGhensi Před 2 lety +1

      @@christianlempa he was referring to ready made official cloud-init images, just like Techno Tim did a few days ago... those steps can be automated using ansible (download image, create proxmox vm, attach disk, create template). To customize the images, one could use libvirt tools beforehand

    • @Rickety3263
      @Rickety3263 Před rokem +2

      Yes. If you are the only contributor to your infrastructure and it lives only on proxmox, and you rarely update or version your software.
      No if you work on a team, use more than one environment, or need to manage patching in a highly regulated security environment

  • @rtacconi
    @rtacconi Před 22 hodinami

    your config really does not work. I think the booting behaviour of Ubuntu has changed. I have been looking around and I cannot find a solution

  • @EduardoSantanaSeverino
    @EduardoSantanaSeverino Před 2 lety +1

    I would simply use terraform

    • @christianlempa
      @christianlempa  Před 2 lety

      You can add terraform to this, but it's actually a good addition, not a replacement.

  • @WojciechKalka
    @WojciechKalka Před rokem

    Use ansible

  • @MarkRuvald
    @MarkRuvald Před 2 lety +1

    Please. NixOS

  • @zyntax81
    @zyntax81 Před 2 lety

    Guys! Don’t Google Packer 😂

  • @matthiasmartin1975
    @matthiasmartin1975 Před rokem

    Dude, it's called "Ubuntu", not "Oh-Bantu". So annoying.
    I feel better now.

  • @supradj
    @supradj Před rokem

    LIKE !!
    But i need:
    debian cloud-init lvm (with explain of partman ;) ) uefi boot
    i found out, that you can separate your packer files for better structure as:
    build.pkr.hcl (source and provisioners)
    build-vars.pkr.hcl (default vars)
    eg. PROXMOX.debian.pkr.hcl (build commands...)
    and build-vars-debian.pkvars.hcl (overrride vars)
    THANKS FOR INIT MY PACKER KNOWLEDGE ;)