Show pageOld revisionsBacklinksAdd to bookExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Proxmox ====== ===== Template ===== <code="bash"> # Set variables for easy customization VMID=9000 VM_NAME="ubuntu-2404-template" # A descriptive name for the template itself # Create the VM with your specified hardware qm create $VMID \ --name $VM_NAME \ --memory 8192 \ --cores 2 \ --net0 virtio,bridge=vmbr0,firewall=0 \ --net1 virtio,bridge=bridgek,firewall=0 \ --ostype l26 \ --scsihw virtio-scsi-pci \ --agent enabled=1 \ --boot order='scsi0;ide2' </code> import image and attach to template with two disks 50G size <code="bash"> # Create a temporary directory to work in mkdir /tmp/cloud-image cd /tmp/cloud-image # Download the Ubuntu 24.04 LTS Cloud Image for AMD64 wget https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img # IMPORTANT: Replace 'local-lvm' with your target storage name qm importdisk $VMID ubuntu-24.04-server-cloudimg-amd64.img local-lvm # Attach the imported disk to the SCSI controller # IMPORTANT: Replace 'local-lvm' with your storage name qm set $VMID --scsi0 local-lvm:vm-9000-disk-0 # Resize the disk to 50G (you can choose a different size) qm resize $VMID scsi0 50G # Create a cloud-init drive # IMPORTANT: Replace 'local-lvm' with your storage name qm set $VMID --ide2 local-lvm:cloudinit # Add a new, empty 50GB disk to the template # IMPORTANT: Replace 'local-lvm' with your storage name qm set $VMID --scsi1 local-lvm:50 # Set the user account that will be created qm set $VMID --ciuser galileo # Paste your SSH public key here for passwordless login # You can get your key with: cat ~/.ssh/id_rsa.pub qm set $VMID --sshkeys id_ed25519.pub # Configure the network interfaces to use DHCP # This is the most flexible option for a template qm set $VMID --ipconfig0 ip=dhcp qm set $VMID --ipconfig1 ip=dhcp # qm set 203 --ipconfig0 ip=10.1.109.203/24,gw=10.1.109.1 # (Optional but recommended) Set a DNS server qm set $VMID --nameserver 8.8.8.8 # convert vm to template qm template $VMID </code> ===== VM ===== create VM from template 9000 <code="bash"> # Choose a new VMID for your instance (e.g., 101) NEW_VMID=201 NEW_VM_NAME="k1" # Clone the template qm clone 9000 $NEW_VMID --name $NEW_VM_NAME --full # Start the new VM qm start $NEW_VMID </code> tips/proxmox.txt Last modified: 2025/10/24 12:50by sscipioni