Proxmox; Trying Clones and Templates

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] good morning and welcome back it's a warm morning here in the Philippines they've been having a heat wave here in Southeast Asia in this video I want to cover cloning and templating of virtual machines and proxmox in addition I want to talk about cloning virtual machines which is not a proxar only discussion and this is more about preparing your clones and actually doing the cloning this is somewhat new to me uh cloning and templates and proxmox that is I've been doing clones of various VMS in Virtual box for years almost as long as I've been using virtual box I mean it was generally standard practice to make a base image and then clone it and play with it and if you broke it toss the Clone make a new clone like a lot of things in proxmox it should be intuitive however I got some mixed results initially probably a result of my experience with virtual box is there are some distinct differences in how the cloning Works between that and proxmox so as usual a bit of study was required one thing that came up with proxmox more than often is preparing the VM for cloning or templating uh this is something I really never saw a lot on any of the tutorials I I reviewed on poning on Virtual box but it comes up pretty much all well most of the time on prox boox anyway let's go ahead and get to the discussion at [Music] hand after thinking a little about my opening remarks I want to sort of mix up this presentation order a little bit I feel like I should discuss the wise of cloning and templating before we actually talk about cloning and templating not just the house I do want to mention I still use Virtual box it's on my laptop and when I'm not here in my home lab away from home I and I find the need to create a clone virtual box works great I mean it's more resource intensive than prox MOX but it still works and does the job it's fairly straightforward so this is no knock against virtual box it's just uh different use cases require different tools uh one of the things I I said in the introduction my prologue is I've when I was cloning with a virtual box never really worried about preparing a virtual machine for cloning but this seems to be a much more important issue in proxmox so I had to take a little look into that as well so for this video I want to cover why I would clone a machine and again this is for me you might have your own reasons or your reasons might be the same as mine don't know I want to talk about the difference between a clone and a template and I'm going to mention something in proxmox called a cloud template I also want to talk about things to do in preparation for cloning I'll end this particular video with a discussion of how to create clones and templates for a VM as as well as the post cloning uh procedures one should probably go through after you have a new working VM from a clone now I want to take a minute to discuss the procedure I worked out for this video this is not the IND all way of doing things and believe me you probably do things a different way than I do but after uh like I said I did a lot of cloning with the virtual box and then after reading a lot of tutorials and doing some experimentation and what you're seeing here is very much ear cloning and templating and prox MOX experimentation if you will again my process is first to build the perfect VM and I don't mean I mean perfect in a more esoteric sort of sense in that uh call it my golden base VM for whatever operating system I'm working with in this case it's going to be Debian 12 but I will set it up a base install with as few packages and get it into condition condition that I want to use it for a base for other experiments other types of VMS then I'm going to clone my golden base and I'm going to call that my golden clone that's the procedure we'll be looking at as well uh as far as making the base we're going to go through that really really quickly because I cover that in other videos actually then we'll demonstrate turning your golden base into a golden clone then we'll make changes to the golden clone I don't want to mess up my Bas VM in case I I mess up the Clone I can just delete it and start over once the Clone is set up for uh templating we'll create our golden template from our golden clone and then from that golden template we will create additional virtual machines that will serve other purposes be built up in different directions and so on so that's basically my process here so without any further Ado let's get to it okay clones and template a clone is an exact copy of a virtual machine in our case it's a software clone because we're just cloning the software the hardware is sort of set up for all the machines the same it includes the operating system and the applications as well as all the settings why clone well for myself I create a golden base image of an OS and I'm going to be building multiple different types of images from that with that OS and I can basically clone the Basse OS and then expand it to the purpose I want I should note that even if you have a golden clone it's eventually going to be out of date even if you have a uh rolling release or a set release for your distribution at some point it will be out of date you'll need to make a new one the other reason is to test new Concepts on a clone so I can actually clone a machine and try and Implement something new and see what happens and if it breaks Beyond repair you can just uh Delete the Clone and make a new one and try again now a template's a little different than a clone templates make it easier and faster to create a VM a template is made from a clone and well it takes at least for me so far about 20 to 30 seconds to clone a v m a template usually clones in about 5 Seconds since templates can't be edited they protect the Integrity of your golden image and like I say they're faster and there is something called a cloud image that can be used to create a template and this a lot of uh major distributions have cloud images available online that are in the correct format to be used with proxmox you download those instead of actually creating a golden image from the install script you download one of these uh pre-built ones and that becomes your image uh issues I have with these are the same I had with the containers you never know exactly what's in them you need to use one and investigate and go through it a couple times just to find out what's there I mean there's nothing wrong with using them it's just you don't know what's in them initially until you've actually used one for a while so for example if you go to uh HTTP cloud. de.org images Cloud you'll find the cloud images that could be used for deban well last time I checked it was Debian 11 no one's made a Debian 12 Cloud image yet but I'm sure well not on the Debian side I know there's a couple out there on other sites but you can also find Ubuntu and there's a turnkey site that has images that are more than base images they're actually set up for a particular purpose be it security be it web server be it whatever and those is the same thing they Cloud image uh in this uh tutorial we're not going to be using the cloud image all right we're going to go ahead and build our Debian image we're going to install a base image with just the base software on it we're going do this fairly quickly I'll mention a few things along the way when we get to them uh the network we're going to f configures DHCP that's better for a something you're going to clone uh even if it was set up for static you would still have to go in and set it on your clone so even if it's DHCP and you want static you can still change it it just will get a its own IP address that way or giving it a host name and a domain and these are things you may need to change but we'll get to that our passwords uh we're creating a root password so it's not going to install Pudo by default which it would if you didn't create a r password so we create a standard user we put everything in one uh partition and then we uncheck everything when we are actually doing the uh software update in the uh task select except for uh standard system utilities and uh that's it we pretty much quickly set up our Debian base image we're going to have to make some modifications to this image before we can use it though uh one thing to note here is the uh number we gave to our uh virtual machine that we're going to clone I used 901 to separate it from the other ones I've got sort of a pattern here with numbers 100s are on the Olympus uh node and the 200s are on the tardus Node 900s are going to be what I use in this particular setup to just to keep them separate so you know what you're looking at I also added a comment here and the date of creation so we're going to jump over to the console we're going to log in as root going take a quick look in the SSH directory uh we need to know what's there for a little later you'll you'll see here's our machine ID and Etsy machine- ID this is something that a lot of uh tutorials tell you you need to a blank out so it'll change in Debian there's another version of this file in variable lib debus machines and it's the same number so I've found over a few tests that you got to change both of them or you're going to end up with the same machine ID uh I'm doing a little research into why this is important but uh one thing I found is that certain distributions using a system D for Stuff use the machine idid instead of the uh Mac address which could mess up your network that's the only really example I found if anybody knows any other examples please let me know now we look at our host name here and or host file we need to know these file locations because when we when we spin up a new clone we're going to have to change some of these so they won't be the same as the old one uh again this is mainly to avoid conflict on a network we can also look at our network interfaces file and we can see that we're set up for a DHCP on our network interface so those are the important things we need to look at and think about when we're creating a clone that they may need to change or excuse me so since we want our clones to be able to access through SSH and we want our non user to have pseudo privileges we need to install those files we're going have to do that through the proxmox interface because we don't have a SSH cap servers installed yet so first thing we'll do is an update and then we'll do an upgrade and then we're going to install use apt to install op SSH server and PSE sudo once they're installed we do a VI PSE sudo to look at the pseudo file and we make sure that the group PSE Sudo is available and active and it is uh if you're familiar with Debian a lot of the stuff you're probably not going to do because you already know what the results are going to be but I'm just showing everything now if we look in our group file we can see pseudo there it's an Etsy group but nothing's attached to it so we'll do a user mod and add pseudo to our nonroot user and therefore after we reboot we should be able to uh go in Via op SSH and or nonr user should be able to do some root operations also want to take a look at our IPA to see what our Network address is and our we want to check our Network address as well as our Mac address then we'll go ahead and power down our golden image and we're ready to move on okay okay now that we got our golden image the way it is let's go ahead and make a clone out of it there are two places you can uh figure out how to do this there are two places you can do this if you rightclick on the actual VM itself you'll find both clone and convert to template if you select your VM and then you come up here to the more button you'll find the same two entries uh clone and clone the template we're going to go ahead and just make a clone we're going to give it a new number we'll give it 90002 since or 9002 and we'll give it a name and then we'll hit clone and we will wait for it to clone and configure itself and it should take around 20 to 30 seconds something like that and there we have it that was all there was to making a cloned image unfortunately that's not all there is to it but yeah that was making the Clone image now that we have a cloned image let's go ahead and see about SSH again I will be using putty here uh we'll go ahead you you'll notice when we uh connect to the machine the host key does not match so we've got a chance to accept the host key this is like a fingerprint for the host it should be the same one that's actually on our uh golden image anyway once we're in we got to use our non-root user and password because root login through ssh in this case is not allowed now if we we take a look in our uh Etsy SSH directory we can see all the uh files have been added as SSH host these are the keys uh when we C when we uh make a template out of this we're going to want to delete all these keys we're going to want to leave everything else in this folder uh interestingly they won't autop populate but we'll get to that look in hosts and host name and we can see we've still got the same host name and fully qualified domain name as uh we had in our golden machine well uh probably leave those for now and this is something you're going to really have to change in the end result virtual machine you're going to be using you have to go in and change the host name and of course we still got our machine ID okay let's uh take a look at machine ID as I've seen ad mentioned a lot when I do tuto when I read tutorials or watch videos there happens to be a man page for it let's make a little bigger text what I'm interested in is this section right here where first boot semantics so number one if the machine if it does not exist that should be for a new machine but it does exist uh two uninitialized three yes I've tried all these scenarios the one that seems to work best is scenario two where I change the content to uninitialized and then it will get a new machine ID when the machine is run when the virtual machine is Run for the first time I've heard people say that three just delete the uh actual machine ID from the file and save it but I've had better luck using un initialized so that's what I'm going to do so let's start our preparation by first getting rid of our machine IDs if we try this as the normal user permissions denied uh pseudos may or may not work but I think we really need to become root so we'll use Su to become root and then we'll Echo uninitialized single uh greater than key and uh except machine IDs this will overwrite the content of the file with un initial initialized if we had done a double greater than it would have just appended and as you can see uninitialized and then we want to do it to the second file and the Deb installation in variable lib debus and they should both be ready now the next thing we really want to do is remove the SSH fingerprints and we're going to have to deal with this on our uh final outcome machine but we'll get to that so we'll use pseudo remove SSH host star or password and that should clear out all the uh fingerprint Keys we want to clear out so when we do SSH again we can have its own set of keys for this whatever machines we create but again like I say there's a second part to this we're going to see in a little bit once we're done with these changes we're going to go ahead and want to power down I mean we don't have a specific user we need to remove because both users we have are generic so we'll go ahead and shut the machine down okay now that we've got our clone shut down let's go ahead and convert it into a template this is pretty simple it's a single menu option and again you can find it if you right click on the uh VM itself or you go up to the more menu but we're going to go ahead and hit convert to template and then we'll say yes now at this point our golden IM our golden clone is going to be gone our golden image we made originally still there but our golden clone has going to be changed into our golden template and this should only take a few seconds and you'll notice now that the icons changed we have a little like a piece of paper behind the monitor icon this shows it's a template now and if you try and edit it you'll find out you can't edit it you can't even start it up you can't really do anything with it other than clone it so now that we have our template let's go ahead and turn that into a virual machine we'll actually use we'll again right click on it or we'll use the more menu and we'll tell it to clone we need to give it a new ID number I'm going have to come up with better names and ID numbers here at some point we're going to call it 301 and debb in testing yeah definitely going to have to think about names and IDs here and you'll notice it takes about 5 Seconds to actually create this as opposed to the 20 to 30 seconds with the going from a VM to cloning a new VM and that's it we've actually created our VM so now that we've created a new VM let's go ahead and start it up and we're going to have to do some work on it to make get actually ready for work so we'll log in through prox mox's root because I can guarantee you we will not be able to do it via putty and ssh in fact let's demonstrate that right now see connection refused so let's log in through proxmox and you'll see we had no new keys created and this may be a Debian thing I'm going to play around with Arch a little later and see if it does the same thing but to get our SSH keys back or not get them back but get a new set in deban we're going to use a lowlevel d package reconfigure of open SSH server and now we have SSH keys so now if we try and log in it sees these are new SSH fingerprint keys because you get this message again saying it's never logged in here for so that's good that's what we wanted we wanted a different set of SSH keys on this uh clone on this virtual machine so we can go ahead and log in as RT and proceed to check our network settings you can also see we've got a new uh Mac address but we're still using the IP address I'm not quite sure why this is but if you start up the original machine we built that uses this IP address first then this one will get a new lease and a new IP address not sure quite the details there I'm going have to look into it some more okay next step let's check our machine ID we've done this before and we can see we actually have a new machine ID in Etsy machine ID however and I'm not sure why this is I'll have to look into this the I think it has something to do with the install but the variable lib debus machine ID did not change is still uninitialized so we'll simply just copy over the one from uh Etsy into the variable lib debus and now we have them both changed okay the next thing we want to look at doing is changing our host name and well if needed you can change your domain name so let's go ahead and edit our host name file and and we're just going to call this D12 make it simple and then you also need to edit the host file and make the same changes here we're going to use the same domain name so once these changes are made once you reboot we should have a new host or a host name speaking of reboot let's go ahead and do that now and we'll change our node here since that got copied over with the Clone and our image should be ready to go use is normal should not have any interference from any other images and that's what we want so we so we're done at this point all right that's our video for the day it's been an interesting row here interesting rad to ho okay H anyway this was my first time through it so things were a little rough and I'm sure there are probably better ways to do things than what I'm doing I didn't really cover the whole Cloud template part of it and uh I may or may not cover that in a later video but again I'm sure once I get more experienced I might want to redo this video and simplify things but I just want I'm using deban 12 but I wanted to cover everything so it could be easily interpolated into another distribution say Arch and I'm going to probably want to look at some things in Arch too because from the tutorials and the other stuff I've read this didn't behave quite the way I was going to it didn't behave quite the way I was expecting it to behave so there are some interesting things for me to look into and think about I hope you enjoyed this please like Please Subscribe and if you feeling up to it please comment and we'll see you all again next time thanks for joining us or joining me anyways [Music] a [Music]
Info
Channel: RetiredTechie
Views: 421
Rating: undefined out of 5
Keywords: Proxmox, Template, Clone, Debian, cloud, network, identifiers
Id: oIzwFoH5y9U
Channel Id: undefined
Length: 28min 7sec (1687 seconds)
Published: Wed May 01 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.