spinside f7b3b06d30 Updated SCL command to Python 3.6 instead of 3.5 (#4912)
* Updated SCL command to Python 3.6 instead of 3.5

Instructions are for installing Python 3.6 but the scl command given assumes you have Python 3.5

* Updated autostart systemd template to use Python 3.6
2018-03-14 08:02:21 +01:00

2.1 KiB

layout, title, description, date, sidebar, comments, sharing, footer
layout title description date sidebar comments sharing footer
page Installation on CentOS/RHEL Installation of Home Assistant on your CentOS/RHEL computer. 2017-03-01 07:00 true false true true

To run Python 3.x on CentOS or RHEL (Red Hat Enterprise Linux), Software Collections needs to be activated first.

You must install Python 3.5.3 or later. Software Collections version of Python 3.5 is 3.5.1 so this guide uses Python 3.6.

{% linkable_title Using Software Collections %}

First of all install the software collection repository as root. For example, on CentOS:

$ yum install centos-release-scl

Then install the Python 3.6 package:

$ yum install rh-python36

Once installed, switch to your homeassistant user (if you've set one up), enable the software collection and check that it has set up the new version of Python:

$ scl enable rh-python36 bash
$ python --version
Python 3.6.3

You will be in a command shell set up with Python 3.6 as your default version. The virtualenv and pip commands will be correct for this version, so you can now create a virtual environment and install Home Assistant following the main instructions.

You will need to enable the software collection each time you log on before you activate your virtual environment.

{% linkable_title Systemd with Software Collections %}

To autostart Home Assistant using systemd follow the main instructions and adjust the template as follows:

[Unit]
Description=Home Assistant
After=network.target

[Service]
Type=simple
User=homeassistant
# Make sure the virtualenv Python binary is used
Environment=VIRTUAL_ENV="/srv/homeassistant"
Environment=PATH="$VIRTUAL_ENV/bin:$PATH"
# ExecStart using software collection:
ExecStart=/usr/bin/scl enable rh-python36 -- /srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target