Skip to content

Instantly share code, notes, and snippets.

@erichelgeson
Forked from Jelle-S/install_ha_vb.sh
Last active January 3, 2025 20:44
Show Gist options
  • Save erichelgeson/df837c0a45663a3a54fa4209107d0c90 to your computer and use it in GitHub Desktop.
Save erichelgeson/df837c0a45663a3a54fa4209107d0c90 to your computer and use it in GitHub Desktop.
Install Home Assistant on VirtualBox
# Installs Home Assistant on VirtualBox following https://www.home-assistant.io/installation/linux
# Install VirtualBox
sudo apt-get -y install virtualbox
# Remove KVM if installed:
sudo apt-get purge libvirt* kvm qemu*
# Create a new VM
VBoxManage createvm --name homeassistant --register
# Select OS type "Other Linux (64-bit)"
VBoxManage modifyvm homeassistant --ostype Linux_64
# Set RAM to 6GB (modify to your needs, TODO: make this an option, default value 2GB), video memory to 16MB (TODO: make this an option, default value 16MB)
VBoxManage modifyvm homeassistant --memory 6144 --vram 16
# 2 vCPUs (TODO: make this an option, default value 2)
VBoxManage modifyvm homeassistant --cpus 2
# Download the latest vdi image (TODO: Always use the latest version)
wget https://github.com/home-assistant/operating-system/releases/download/14.1/haos_ova-14.1.vdi.zip
sudo apt-get -y install unzip
unzip haos_ova-14.1.vdi.zip
rm haos_ova-14.1.vdi.zip
# Resize the harddisk to 100GB (TODO: make this an option, default value 32GB)
VBoxManage modifyhd "haos_ova-14.1.vdi" --resize 102400
# Move the vdi image to a location of choice (TODO: make this an option, default value TBD)
mv haos_ova-7.2.vdi VirtualBox\ VMs/homeassistant/
# Add the SATA controller
VBoxManage storagectl homeassistant --name "SATA Controller" --add sata --controller IntelAHCI
# Attach the vdi image (TODO: use the vdi path option)
VBoxManage storageattach homeassistant --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/homeassistant/haos_ova-14.1.vdi
# Create the bridged adapter (TODO: Figure out a way to detect the netwerk adapter, or add it as an option)
VBoxManage modifyvm homeassistant --nic1 bridged --nictype1 82540EM --bridgeadapter1 enp0s31f6
# Enable EFI
VBoxManage modifyvm homeassistant --firmware efi
# Set Intel HD Audio as Audio controller
VBoxManage modifyvm homeassistant --audiocontroller hda
# Enable USB
wget https://download.virtualbox.org/virtualbox/7.0.16/Oracle_VM_VirtualBox_Extension_Pack-7.0.16.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.16.vbox-extpack
VBoxManage modifyvm homeassistant --usb on
# Start Home Assistant headless
VBoxManage startvm homeassistant --type headless
# Find USB passthrough device uuid
VBoxManage list usbhost
VBoxManage controlvm homeassistant usbattach xx-xx-xx
# Get MAC and lookup in router for ip
VBoxManage showvminfo homeassistant | grep 'MAC:'
# Access it at
http://<ip>:8123/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment