I completed a 2023.9.2 HA core installation using AlmaLinux 9 distro in a VM running on ESXi 7.0 Update 3. @ocgltd your installation via a container is probably a better solution and is recommended over core. I used in the past HA core on a CentOS 7 distro to simplify the installation of Socat to access my Z-Wave stick connected to a Raspberry Pi. Now Socat is not needed anymore with the addition of Z-Wave JS UI, but it is hard to change old habits, I am going to stick with core. I have found during my past experiences doing these core installs of HA, AppDaemon, ESPHome, etc… on a CentOS 7 VM that uses the core python from the distro is not ideal. I prefer installing the appropriate versions of Python separately, this gives me more flexibility with the install.
To compile Python from the source you are going to need the dev packages. Do first an update of your distro and fetch the following:
dnf install wget yum-utils make gcc gcc-c++ systemd-devel openssl-devel bzip2 bzip2-devel libffi-devel zlib-devel readline-devel sqlite-devel xz-devel tk-devel gdbm-libs ncurses-devel libjpeg-turbo-devel giflib tar git
Note: some of the above packages are not needed to build Python but they have been useful for my use of HA. I do my build of Python in: /usr/src:
cd /usr/src
Downloaded the Python version needed:
wget https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tgz & tar xzf Python-3.11.5.tgz
Note: nproc will provide the number of CPU used in the compile. You will need enough memory to compile the optimizations i.e. --enable-optimizations. My vm setup uses 2 vCPUs and 2 GB of memory:
cd Python-3.11.5
./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions --enable-optimizations
make -j ${nproc}
make altinstall
Check the Python version:
python3.11 -V
Hopefully the above worked i.e., Python 3.11.5. Time to use the above build. I create my HA virtual env in folder: /srv/homeassistant and my user is: homeassistant
mkdir /srv/homeassistant
useradd -rm homeassistant
chown homeassistant:homeassistant /srv/homeassistant
Create the Python virtual environment pip package installation as role user homeassistant, creates the folder structure and configuration for the Python virtual env.
sudo -u homeassistant -H -s
/usr/local/bin/python3.11 -m venv /srv/homeassistant
Activate the Virtual Environment i.e. for Python 3.11.5. Download the appropriate runtime modules. Note there is a bug: module 'urllib3.util' has no attribute 'PROTOCOL_TLS' · Issue #95192 · home-assistant/core · GitHub and I had to retrieve the fix using git:
source /srv/homeassistant/bin/activate
python -m pip install wheel
pip install homeassistant
pip install git+https://github.com/boto/botocore
And voila I hope you can run HA:
hass
Ctrl C to leave HA
Exit user homeassistant
exit
You can configure the Autostart configuration using systemd
Documented at multiple places: Autostart using systemd in /etc/systemd/system/[email protected]
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
WorkingDirectory=/home/%i/.homeassistant
ExecStart=/srv/homeassistant/bin/hass -c “/home/%i/.homeassistant”
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
Resolve SELinux permission issues: Getting "Permission Denied" When Trying to Auto-Start (HA Works Great Otherwise!), I changed the permission in conf file: /etc/selinux/config
SELINUX = permissive
Start and enable the service:
systemctl --system daemon-reload
systemctl start home-assistant@homeassistant
systemctl enable home-assistant@homeassistant