Virtual Box: Install & How to Commands
- Chris Speed
- Sep 9, 2019
- 1 min read
Updated: Mar 16, 2024
Update the package lists for upgrades and new package installations:
sudo apt update
Install necessary dependencies:
sudo apt install -y build-essential linux-headers-$(uname -r)
Download the VirtualBox repository key:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
Add the VirtualBox repository to your system's software repository list:
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
Update the package lists again:
sudo apt update
Install VirtualBox:
sudo apt install -y virtualbox-6.1
Note: The above command installs VirtualBox version 6.1. You can adjust the version number if a newer version is available.
Add your user to the vboxusers group:
sudo usermod -aG vboxusers $USER
Reboot your system:
sudo reboot
-----------------------------------------------
#Resize VBox Hard Drive
VBoxManage modifyhd MyLinux.vdi --resize 100000 (100 GB)
# List virtual machines
VBoxManage list vms
"MyVM" {e4b0c92c-4301-4a7d-8af8-fe02fed00451}
# Start VM in headless mode
VBoxManage startvm MyVM --type headless
# Power off VM
VBoxManage controlvm MyVM poweroff
# Show running VM
VBoxManage list runningvms
# Show VM Properties
VBoxManage guestproperty enumerate <vmname>
Reference:
VBoxManage. https://www.virtualbox.org/manual/ch08.html
Comments