0% found this document useful (0 votes)
71 views

Linux - Home Assistant - Install Home Assistant Core

Linux - Home Assistant - Install Home Assistant Core

Uploaded by

faszomjoska23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Linux - Home Assistant - Install Home Assistant Core

Linux - Home Assistant - Install Home Assistant Core

Uploaded by

faszomjoska23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

9/13/24, 4:04 PM Linux - Home Assistant

2024.9.1

Home ▸ Installation ▸

Linux
Install Home Assistant Operating System
DOWNLOAD THE APPROPRIATE IMAGE
VirtualBox (.vdi)
KVM (.qcow2)

After downloading, decompress the image. If the image comes in a ZIP file, for
example, unzip it.

Follow this guide if you already are running a supported virtual machine
hypervisor. If you are not familiar with virtual machines, install Home Assistant OS
directly on a Home Assistant Yellow, a Raspberry Pi, or an ODROID.

CREATE THE VIRTUAL MACHINE


Load the appliance image into your virtual machine hypervisor. (Note: You are free
to assign as much resources as you wish to the VM, please assign enough based
on your add-on needs).

Minimum recommended assignments:

2 GB RAM
32 GB Storage
2vCPU

All these can be extended if your usage calls for more resources.
https://www.home-assistant.io/installation/linux#install-home-assistant-core 1/12
9/13/24, 4:04 PM Linux - Home Assistant

HYPERVISOR
2024.9.1
SPECIFIC CONFIGURATION
VirtualBox Unraid KVM (virt-manager) KVM (virt-install)

1. Create a new virtual machine.


2. Select type Linux and version Linux 2.6 / 3.x / 4.x (64-bit).
3. Under Hardware, select the amount of memory and number of CPUs.
Then, select Enable EFI.
Make sure EFI is enabled. If EFI is not enabled, HAOS won’t boot.
4. Under Hard Disk, select Use an existing virtual hard disk file, select the
unzipped VDI file from above.
5. Then go to Network > Adapter 1. Choose Bridged Adapter and choose
your network adapter.
Please keep in mind that the bridged adapter only functions over a
hardwired Ethernet connection. Using Wi-Fi on your VirtualBox host is
unsupported.
6. Then go to Audio and choose Intel HD Audio as audio controller.

By default, VirtualBox does not free up unused disk space. To automatically


shrink the vdi disk image the discard option must be enabled using your host
machine’s terminal:
VBoxManage storageattach <VM name> --storagectl "SATA" --port 0 --device 0 --
nonrotational on --discard on

More details can be found about the command can be found here .

START UP YOUR VIRTUAL MACHINE


1 Start the virtual machine.
2 Observe the boot process of the Home Assistant Operating System.
3 Once completed, you will be able to reach Home Assistant on
homeassistant.local:8123 . If you are running an older Windows version or
https://www.home-assistant.io/installation/linux#install-home-assistant-core 2/12
9/13/24, 4:04 PM Linux - Home Assistant

have a stricter network configuration, you might need to access Home


2024.9.1 Assistant at homeassistant:8123 or http://X.X.X.X:8123 (replace X.X.X.X

with your ’s IP address).

HELP US IMPROVE HOME ASSISTANT


Have you just installed Home Assistant? The Home Assistant team is
looking to talk to you to understand how the installation went.
Help now

With the Home Assistant Operating System installed and accessible, you can
continue with onboarding.

ONBOARDING

Install Home Assistant Container


These below instructions are for an installation of Home Assistant Container
running in your own container environment, which you manage yourself. Any OCI
compatible runtime can be used, however this guide will focus on installing it with
Docker.

Note
This installation method does not have access to add-ons. If you want to
use add-ons, you need to use another installation method. The
recommended method is Home Assistant Operating System. Checkout the
overview table of installation types to see the differences.

Important
Prerequisites This guide assumes that you already have an operating
system setup and a container runtime installed (like Docker).
https://www.home-assistant.io/installation/linux#install-home-assistant-core 3/12
9/13/24, 4:04 PM Linux - Home Assistant

If you are using Docker then you need to be on at least version 19.03.9,
ideally an even higher version, and libseccomp 2.4.2 or newer.
2024.9.1

PLATFORM INSTALLATION
Installation with Docker is straightforward. Adjust the following command so that:

/PATH_TO_YOUR_CONFIGpoints at the folder where you want to store your


configuration and run it. Make sure that you keep the :/config part.
MY_TIME_ZONE is a tz database name , like TZ=America/Los_Angeles .
D-Bus is optional but required if you plan to use the Bluetooth integration.

Install Update

docker run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-e TZ=MY_TIME_ZONE \
-v /PATH_TO_YOUR_CONFIG:/config \
-v /run/dbus:/run/dbus:ro \
--network=host \
ghcr.io/home-assistant/home-assistant:stable

Once the Home Assistant Container is running Home Assistant should be


accessible using http://<host>:8123 (replace with the hostname or IP of the
system). You can continue with onboarding.

ONBOARDING

RESTART HOME ASSISTANT


If you change the configuration, you have to restart the server. To do that you
have 3 options.

1. In your Home Assistant UI, go to the Settings > System and click the
Restart button.
https://www.home-assistant.io/installation/linux#install-home-assistant-core 4/12
9/13/24, 4:04 PM Linux - Home Assistant

2. You can go to the Developer Tools > Actions, select


2024.9.1
homeassistant.restart and select Perform action.

3. Restart it from a terminal.

Docker CLI Docker Compose

docker restart homeassistant

DOCKER COMPOSE

Tip
docker composeshould already be installed on your system. If not, you
can manually install it.

As the Docker command becomes more complex, switching to docker


compose can be preferable and support automatically restarting on failure or
system restart. Create a compose.yml file:
services:
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- /PATH_TO_YOUR_CONFIG:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
restart: unless-stopped
privileged: true
network_mode: host

Start it by running:
docker compose up -d

Once the Home Assistant Container is running, Home Assistant should be


accessible using http://<host>:8123 (replace with the hostname or IP of the
system). You can continue with onboarding.

ONBOARDING
https://www.home-assistant.io/installation/linux#install-home-assistant-core 5/12
ONBOARDING
9/13/24, 4:04 PM Linux - Home Assistant

2024.9.1

EXPOSING DEVICES
In order to use Zigbee or other integrations that require access to devices, you
need to map the appropriate device into the container. Ensure the user that is
running the container has the correct privileges to access the /dev/tty* file,
then add the device mapping to your container instructions:

Docker CLI Docker Compose

docker run ... --device /dev/ttyUSB0:/dev/ttyUSB0 ...

OPTIMIZATIONS
The Home Assistant Container is using an alternative memory allocation
library jemalloc for better memory management and Python runtime
speedup.

As jemalloc can cause issues on certain hardware, it can be disabled by


passing the environment variable DISABLE_JEMALLOC with any value, for
example:

Docker CLI Docker Compose

docker run ... -e "DISABLE_JEMALLOC=true" ...

The error message <jemalloc>: Unsupported system page size is one known
indicator.

Install Home Assistant Core


Caution
This is an advanced installation process, and some steps might differ on
your system Considering the nature of this installation type we assume
https://www.home-assistant.io/installation/linux#install-home-assistant-core 6/12
9/13/24, 4:04 PM Linux - Home Assistant
your system. Considering the nature of this installation type, we assume
you can handle subtle differences between this document and the
2024.9.1
system configuration you are using. When in doubt, please consider one
of the other installation methods, as they might be a better fit instead.

PREREQUISITES
This guide assumes that you already have an operating system setup and have
installed Python 3.12 (including the package python3-dev ) or newer.

INSTALL DEPENDENCIES
Before you start, make sure your system is fully updated, all packages in this
guide are installed with apt , if your OS does not have that, look for
alternatives.
sudo apt-get update
sudo apt-get upgrade -y

Install the dependencies:


sudo apt-get install -y python3 python3-dev python3-venv python3-pip bluez libffi-
dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff6
libturbojpeg0-dev tzdata ffmpeg liblapack3 liblapack-dev libatlas-base-dev

The above-listed dependencies might differ or missing, depending on your


system or personal use of Home Assistant.

CREATE AN ACCOUNT
Add an account for Home Assistant Core called homeassistant . Since this
account is only for running Home Assistant Core the extra arguments of -rm
is added to create a system account and create a home directory.
sudo useradd -rm homeassistant

CREATE THE VIRTUAL ENVIRONMENT


First we will create a directory for the installation of Home Assistant Core and
https://www.home-assistant.io/installation/linux#install-home-assistant-core 7/12
First we will create a directory for the installation
9/13/24, 4:04 PM
of Home Assistant Core and
Linux - Home Assistant

change the owner to the homeassistant account.


2024.9.1

sudo mkdir /srv/homeassistant


sudo chown homeassistant:homeassistant /srv/homeassistant

Next up is to create and change to a virtual environment for Home Assistant


Core. This will be done as the homeassistant account.
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate

Once you have activated the virtual environment (notice the prompt change
to (homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ ) you will
need to run the following command to install a required Python package.
python3 -m pip install wheel

Once you have installed the required Python package, it is now time to install
Home Assistant Core!
pip3 install homeassistant==2024.9.1

Troubleshooting: If you do not see the above version of Home Assistant


package in your environment, make sure you have the correct Python version
installed, as defined under the Prerequisites.

Start Home Assistant Core for the first time. This will complete the installation
for you, automatically creating the .homeassistant configuration directory in
the /home/homeassistant directory, and installing any basic dependencies.
hass

You can now reach your installation via the web interface on
http://homeassistant.local:8123 .

If this address doesn’t work you may also try http://localhost:8123 or


http://X.X.X.X:8123 (replace X.X.X.X with your machines’ IP address).

Note
When you run the h command for the first time it will download
https://www.home-assistant.io/installation/linux#install-home-assistant-core 8/12
9/13/24, 4:04 PM Linux - Home Assistant
When you run the hass command for the first time, it will download,
install and cache the necessary libraries/dependencies. This procedure
2024.9.1
may take anywhere between 5 to 10 minutes. During that time, you may
get a site cannot be reached error when accessing the web interface.
This will only happen the first time. Subsequent restarts will be much
faster.

Install Home Assistant Supervised


Caution
This way of running Home Assistant will require the most of you. It also
has strict requirements you need to follow.
Unless you really need this installation type, you should install Home
Assistant OS (this can also be a virtual machine), or Home Assistant
Container.

1. First make sure you understand the requirements .


2. This installation method has very strict requirements, for example, it only
supports Debian (and Ubuntu, Armbian, Raspberry Pi OS are not
supported). So, make sure you understand the requirements from step 1
above.
3. Then head over to home-assistant/supervised-installer to set it up.
Once the Home Assistant Supervised installation is running and Home
Assistant is accessible you can continue with onboarding.

ONBOARDING

Troubleshooting
NO ACCESS TO THE FRONTEND
https://www.home-assistant.io/installation/linux#install-home-assistant-core 9/12
9/13/24, 4:04 PM Linux - Home Assistant

Symptom: You cannot open the Home Assistant page in your browser. If you
2024.9.1
are not using Home Assistant Operating System, the cause may be an access
restriction.

In newer Linux distributions, the access to a host is very limited. This means
that you can’t access the Home Assistant frontend that is running on a host
outside of the host machine.

To fix this, you will need to open your machine’s firewall for TCP traffic to port
8123. The method for doing this will vary depending on your operating system
and the firewall you have installed. Below are some suggestions to try. Google
is your friend here.

For UFW systems (for example, Debian):


sudo ufw allow 8123/tcp

HELP US IMPROVE OUR DOCUMENTATION


Suggest an edit to this page, or provide/view feedback for this page.
Edit Provide feedback View given feedback

Home Assistant is a project from the Open Home Foundation, sponsored by Nabu Casa.

https://www.home-assistant.io/installation/linux#install-home-assistant-core 10/12
9/13/24, 4:04 PM Linux - Home Assistant

JOIN US AND CONTRIBUTE!


2024.9.1
GitHub repo
Developers Portal
Design Portal
Data Science Portal
Community Forum
Reporting issues
Community Merch Store

SYSTEM STATUS
Integration Alerts
Security Alerts
System Status

COMPANION APPS
iOS and Apple devices
Android and Wear OS
...and more!

GOVERNANCE
Privacy Notices
Contributor License Agreement
Terms of Service
Code of Conduct
Credits
License

FOLLOW US
Sign up for our newsletter

Contact us here for media and partnership inquiries. (No technical support!)

Website powered by Jekyll


Originally based on the Oscailte theme

https://www.home-assistant.io/installation/linux#install-home-assistant-core 11/12
9/13/24, 4:04 PM Linux - Home Assistant

2024.9.1

https://www.home-assistant.io/installation/linux#install-home-assistant-core 12/12

You might also like