Deploy VMs in a Flash: The Ultimate Guide to Proxmox Template

    Updated on December 4, 2024

    Reading Time: 1 min read

    Facebook
    Twitter
    LinkedIn

    Introduction to Proxmox Templates

    Proxmox Virtual Environment (Proxmox VE) offers a powerful platform for virtualization, allowing you to run virtual machines seamlessly. In this guide, we will walk you through the process of adding a cloud image, specifically Almalinux 9, to Proxmox. This procedure is not only limited to Almalinux 9; you can follow the same steps for other Linux distributions.

    Step 1: Log in as Root to Proxmox Cluster via SSH

    				
    					ssh root@your_proxmox_server_ip
    
    				
    			

    Replace your_proxmox_server_ip with the actual IP address of your Proxmox server. Enter the root password when prompted.

    Step 2: Download the Cloud Image

    				
    					cd /
    wget https://repo.almalinux.org/almalinux/9/cloud/x86_64/images/AlmaLinux-9-GenericCloud-latest.x86_64.qcow2
    
    
    				
    			

    This command fetches the Almalinux 9 cloud image and saves it to the root directory.

    Step 3: Create a New VM with Minimal Resources

    				
    					qm create 20000 --memory 1024 --cores 1 --name Almalinux9-template --net0 virtio,bridge=vmbr0 --agent enabled=1 --onboot 1
    
    
    				
    			

    Here, we create a new VM with ID 20000, allocating 1GB of memory, 1 core, and using the virtio network interface.

    Step 4: Import the Downloaded Image to the VM

    				
    					qm importdisk 20000 AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 storage
    
    
    
    				
    			

    This command imports the downloaded cloud image into the VM and specifies the storage location.

    Step 5: Configure the VM's Storage

    				
    					qm set 20000 --scsihw virtio-scsi-pci --scsi0 storage:vm-20000-disk-0
    
    
    
    
    				
    			

    This sets up the VM’s storage using virtio-scsi-pci and associates it with the imported disk.

    Step 6: Configure Cloud Init for the VM

    				
    					qm set 20000 --ide2 storage:cloudinit
    
    
    
    
    
    				
    			

    Cloud-init is configured to handle the initialization of the VM.

    Step 7: Set Boot Options

    				
    					qm set 20000 --boot c --bootdisk scsi0
    
    
    
    
    
    				
    			

    This command sets the boot options, specifying the boot disk as the one we configured in the previous step.

    Step 8: Configure Serial and VGA Options

    				
    					qm set 20000 --serial0 socket --vga serial0
    
    
    
    
    
    
    				
    			

    Serial and VGA options are configured, allowing you to interact with the VM through the Proxmox GUI.

    Step 9: Convert VM to Template in Proxmox GUI

    To complete the setup, open the Proxmox GUI:

    1. Navigate to the “Virtual Machines” tab.

    2. Locate the newly created VM with the Almalinux 9 Cloud Image.

    3. Click on “More” and then select “Convert to Template.”

    This step transforms your configured VM into a template, streamlining the process for future deployments.

    Conclusion

    Congratulations! You have now efficiently configured a VM using the Almalinux 9 Cloud Image on Proxmox and converted it into a template for easy replication. Leveraging templates in Proxmox significantly accelerates and simplifies the VM deployment process. Templates serve as pre-configured models, allowing you to spin up new virtual machines rapidly and conveniently, ensuring consistency and efficiency in your virtualization environment.