Posted in

Cloud Init Installer Script for Proxmox VE

OpsLinuxSec CLOUD INIT INSTALLER is a shell-based tool designed to automate the configuration and deployment of virtual machines in Proxmox Virtual Environment (PVE) using Cloud-Init.
This tool helps streamline VM provisioning — if the required ISO image is not found under /var/lib/vz/images/, the script will fetch it automatically.


Requirements

Before using this script, make sure your system has:

  • wget installed (for ISO downloads)
  • Proxmox VE installed and running
  • root user privileges

The script will auto-check and install missing dependencies.


How to Use

1. Download and Prepare the Script

wget https://github.com/ryanachmad12/cloud-init-prox-script/raw/refs/heads/main/installer.sh
chmod +x installer.sh

2. Run the Script

bash installer.sh

Installation Flow

Step 1: Dependency Check

The script automatically verifies required packages:

Checking dependencies...
All dependencies are satisfied.

Step 2: Main Menu

You’ll be presented with a simple interface:

=============================
        OpsLinuxSec
=============================
1. Use Available OS
2. Custom OS (Provide Image URL)
3. Exit

Choose either a pre-defined OS or input your own download link.


Step 3: Select Distro

Choose Distro:
1. Ubuntu
2. Debian
3. Exit

Step 4: Choose Ubuntu Version

Choose Version:
1. 20.04
2. 22.04
3. 24.04
4. Exit

Step 5: Check Image Availability

If the image is not found, it will prompt you to download:

Image not found at /var/lib/vz/images/focal-server-cloudimg-amd64.img
Would you like to download it? (yes/no)

Step 6: Set Disk Size and VM Configuration

You will be prompted to define VM specs:

Enter disk size (GB): 6
Image resized.

Enter VM ID: 222
VM ID already exists. Please choose another.

Enter VM Name: example
Enter RAM (MB): 512
Enter CPU cores [default: 1]: 
Enable QEMU agent [default: 1]:

Step 7: Choose Target Storage

It will list available storages like:

Target Disk
┌────────────────┬───────────┬─────────┬────────┬───────────┬─────────┬────────┬───────────┬───────────┬───────────────┐
│ content        │ storage   │ type    │ active │ avail     │ enabled │ shared │ total     │ used      │ used_fraction │
╞════════════════╪═══════════╪═════════╪════════╪═══════════╪═════════╪════════╪═══════════╪═══════════╪═══════════════╡
│ rootdir,images │ local-lvm │ lvmthin │ 1      │ 10.10 GiB │ 1       │ 0      │ 11.80 GiB │ 1.70 GiB  │ 14.42%        │
└────────────────┴───────────┴─────────┴────────┴───────────┴─────────┴────────┴───────────┴───────────┴───────────────┘

Enter storage (e.g., local-lvm):

Step 8: VM Creation Completed

Once all parameters are set, the VM will be built and configured automatically:

VM ID 222 created successfully.
Please configure the network settings manually.

Convert to Template

Once the VM is created, you can convert it to a template using Proxmox for future rapid deployments.


Final Notes

  • Make sure the server has enough disk space for image storage and VM files.
  • After creation, network configuration must be done manually via PVE GUI or CLI.

🔗 Source Code

You can find the full source code and updates here:
GitHub Repo: https://github.com/ryanachmad12/cloud-init-prox-script

Leave a Reply

Your email address will not be published. Required fields are marked *