Question: how to install dmg file on virtualbox?
Answer: Double-click on the DMG file, to mount the contents.
A window opens, prompting you to double-click on the VirtualBox. ... 
This will start the installer, which enables you to select where to install Oracle VM VirtualBox.