Effortlessly Import Your VirtualBox/VMware VMs to Proxmox Using Bash Script


๐ Description:
This script streamlines the process of provisioning a VM in Proxmox from an OVA file. It performs the following steps:
Extracts the specified OVA archive.
Converts the contained virtual disk (VMDK/VHD) to QCOW2 format.
Creates a new Proxmox VM with basic resources.
Imports the QCOW2 disk into a specified Proxmox storage.
Attaches the imported disk as a SCSI device to the created VM.
๐ง Prerequisites
Proxmox VE with
qm
andqemu-img
utilities installed and accessible in your PATH.Appropriate permissions to create VMs and access storage on the Proxmox host.
The OVA file and working directory must be readable/writable by the script user.
๐ Usage
./import_ova.sh <OVA_FILE> <VM_ID> [STORAGE] [TEMPLATE_DIR]
๐ OVA Import Parameters
<OVA_FILE>
Full OVA filename (including the .ova
extension)
<VM_ID>
Proxmox VM ID to create and import the disk into
[STORAGE]
(Optional)
Proxmox storage target for the disk
Default: local-lvm
[TEMPLATE_DIR]
(Optional)
Directory containing the OVA file and generated images
Default: /var/lib/vz/import
๐ค Upload the OVA to Proxmox server
Web interface:
- you can upload the .ova file in the import section of the local storage Using the proxmox web interface
- This is put the file at /var/lib/vz/import/
Using SCP:
scp vm01.ova root@<proxmox server ip>:/var/lib/vz/template/
โถ๏ธ Run the script:
Get the script at the Github Link
Locally:
git clone https://github.com/sumitsaz23/proxmox-scripts.git cd proxmox-scripts/import_ova/ ./import_ova.sh my-vm.ova 123 my-storage /var/lib/vz/template
Download & Run Directly using
curl:
curl -sSL \ https://raw.githubusercontent.com/sumitsaz23/proxmox-scripts/main/import_ova/import_ova.sh \ | bash -s -- my-vm.ova 123 my-storage /var/lib/vz/template
VM Successfully booting up
Subscribe to my newsletter
Read articles from Sumit Sur directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
