# 下载虚拟机安装包run,并保存为virtualbox7.run
wget -O virtualbox7.run https://download.virtualbox.org/virtualbox/7.0.12/VirtualBox-7.0.12-159484-Linux_amd64.run
sh virtualbox7.run
# 格式转换,超级快,一行代码搞定
VBoxManage convertfromraw /path/to/source.img /path/to/target.vdi --format VDI
# 转换之后的vdi 要赋予最高权限 777 这样才可以确保VirtualBox 虚拟机调用
sudo chmod 777 /path/to/target.vdi
如何安装VirtualBox 7 扩展包(识别USB设备)
wget https://download.virtualbox.org/virtualbox/7.0.12/Oracle_VM_VirtualBox_Extension_Pack-7.0.12.vbox-extpack
echo "y" | sudo VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-7.0.12.vbox-extpack
sudo VBoxManage list extpacks
sudo groupadd usbfs
sudo adduser $USER vboxusers
sudo adduser $USER usbfs
echo "VM 扩展包安装完成,重启后才能生效。重启后USB才可以被虚拟机识别"
sh /opt/VirtualBox/uninstall.sh