Skip to content

Instantly share code, notes, and snippets.

@erichelgeson
Forked from angus151/install_ha_vb.sh
Created August 25, 2024 14:38
Show Gist options
  • Save erichelgeson/d35790de0178faffb106250dd379a7bc to your computer and use it in GitHub Desktop.
Save erichelgeson/d35790de0178faffb106250dd379a7bc 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
# 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/8.2/haos_ova-8.2.vdi.zip
sudo apt-get -y install unzip
unzip haos_ova-8.2.vdi.zip
rm haos_ova-8.2.vdi.zip
# Resize the harddisk to 100GB (TODO: make this an option, default value 32GB)
VBoxManage modifyhd "haos_ova-8.2.vdi" --resize 102400
# Move the vdi image to a location of choice (TODO: make this an option, default value TBD)
mv haos_ova-8.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-8.2.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 enp2s0
# Enable EFI
VBoxManage modifyvm homeassistant --firmware efi
# Set Intel HD Audio as Audio controller
VBoxManage modifyvm homeassistant --audiocontroller hda
# Start Home Assistant headless
VBoxManage startvm homeassistant --type headless
# TODO: Figure out the guest box's IP address and output it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment