# 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:

1. Extracts the specified OVA archive.
    
2. Converts the contained virtual disk (VMDK/VHD) to QCOW2 format.
    
3. Creates a new Proxmox VM with basic resources.
    
4. Imports the QCOW2 disk into a specified Proxmox storage.
    
5. Attaches the imported disk as a SCSI device to the created VM.
    

# **🔧 Prerequisites**

* Proxmox VE with `qm` and `qemu-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**

```bash
./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
        
* ![](https://miro.medium.com/v2/resize:fit:700/1*0_rUcxIkya9235AyBv0upA.png align="left")
    
    * This is put the file at /var/lib/vz/import/
        
    
    ![](https://miro.medium.com/v2/resize:fit:573/1*lWI_WzeM9cVSbSyY88D0dA.png align="left")
    
    * Using SCP:
        
        ```bash
        scp vm01.ova root@<proxmox server ip>:/var/lib/vz/template/
        ```
        
        ![](https://miro.medium.com/v2/resize:fit:700/1*bmGNFexlEHIKDu0h64GvJw.png align="left")
        
        # **▶️ Run the script:**
        
        Get the [script](https://github.com/sumitsaz23/proxmox-scripts/tree/main/import_ova) at the [Github Link](https://github.com/sumitsaz23/proxmox-scripts/tree/main/import_ova)
        
        ## **Locally:**
        
        ```bash
        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:`
        
        ```bash
        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
        ```
        
        ![](https://miro.medium.com/v2/resize:fit:700/1*Ejn2RSdX9WDcAiaKARSYEg.png align="left")
        
        ![](https://miro.medium.com/v2/resize:fit:700/1*3qxm3-GWsVUW6AaK6eHAHA.png align="left")
        
        ## **VM Successfully booting up**
        
        ![](https://miro.medium.com/v2/resize:fit:700/1*M1bN6he4yuJZRnDPeEDO2g.png align="left")
