VirtualBox is a powerful, open-source virtualization software that allows you to run multiple operating systems on a single machine. Here’s a cheat sheet with commands and tasks for VirtualBox:
Installation
Install VirtualBox (Linux):
sudo apt install virtualbox
Install VirtualBox (Windows/Mac):
- Download the installer from the VirtualBox website and follow the installation instructions.
Basic VM Management
Create a VM:
- Open VirtualBox, click “New,” and follow the wizard to create a new virtual machine.
Start VM:
- Select a VM and click “Start” or use the command:
VBoxManage startvm "VM Name" --type headless
Shutdown VM:
- Click “Close” on the VM window or use the command:
VBoxManage controlvm "VM Name" acpipowerbutton
Pause/Resume VM:
- Click “Pause” or use the command:
VBoxManage controlvm "VM Name" pause
Take Snapshot:
- Select a VM, go to “Machine” > “Take Snapshot,” or use the command:
VBoxManage snapshot "VM Name" take "Snapshot Name"
Command-Line Tools
List VMs:
VBoxManage list vms
List Running VMs:
VBoxManage list runningvms
Show VM Information:
VBoxManage showvminfo "VM Name"
Advanced Configuration
Modify VM Settings:
- Right-click on a VM, select “Settings,” or use the command:
VBoxManage modifyvm "VM Name" --memory 2048
Clone VM
Right-click on a VM, select “Clone,” or use the command:
VBoxManage clonevm "Source VM Name" --name "New VM Name" --register
Export VM
Right-click on a VM, select “Export Appliance,” or use the command:
VBoxManage export "VM Name" -o output_file.ova
Networking
Attach VM to Host-Only Network:
- Open VM settings > “Network” > Choose “Host-Only Adapter.”
Port Forwarding:
- VM settings > “Network” > “Advanced” > “Port Forwarding.”
Command-Line VM Control (Windows/Linux)
Start VM:
VBoxManage startvm "VM Name" --type gui
Stop VM:
VBoxManage controlvm "VM Name" poweroff
Take Screenshot:
VBoxManage controlvm "VM Name" screenshotpng screenshot.png
Guest Additions
Install Guest Additions:
- Insert Guest Additions CD from the VirtualBox menu in the VM window.
Command-Line Install (Linux):
sudo ./VBoxLinuxAdditions.run
This VirtualBox cheat sheet covers some fundamental tasks and commands. VirtualBox has extensive features, so refer to the official VirtualBox documentation for detailed information on specific topics.