安装
快速安装:
apt-get install python3-pip
pip3 install homeassistant
hass
一般安装:
apt install python3.5 python3.5-dev
apt install libpython3.5 libpython3.5-dev
将Python3.5设置为默认Python3:
update-alternatives --install /usr/bin/python python3 /usr/bin/python3.5 1
update-alternatives --config python3
Python 虚拟环境安装:
(Home Assistant 官方推荐使用 Python 虚拟环境安装 Home Assistant 以避免影响生产环境。)
- 创建虚拟环境:python3 -m venv homeassistant
- 打开虚拟环境:cd homeassistant
- 激活虚拟环境:source bin/activate
- 安装 Home Assistant:python3 -m pip install --upgrade homeassistant
- 启动 Home Assistant 并打开网页:hass –open-ui
维护
apt-get update
systemctl stop home-assistant@homeassistant.service
su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install –upgrade homeassistant
exit
systemctl start home-assistant@homeassistant.service
更换pip源
vi /home/root/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
清华:https://pypi.tuna.tsinghua.edu.cn/simple
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
安装
Debian / Ubuntu:
apt-get install python-pip
pip install shadowsocks
CentOS:
yum install python-setuptools && easy_install pip
pip install shadowsocks
使用
ssserver -p 443 -k password -m rc4-md5
如果要后台运行:
sudo ssserver -p 443 -k password -m rc4-md5 –user nobody -d start
如果要停止:
sudo ssserver -d stop
如果要检查日志:
sudo less /var/log/shadowsocks.log
用 -h 查看所有参数,也可以使用 配置文件进行配置。
cd /etc/ssh
chmod 0644 *
chmod 0600 ssh_host_rsa_key
service sshd restart
Error:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set.
Fixed:
reboot and login to recovery,
login to root prompt,
mount -o remount,rw /
mount –all
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
ls -l /usr/bin/sudo
chmod 644 /etc/passwd
chmod u+s /bin/su
reboot
Issue: cannot be loaded because the executionof scripts is disabled on this system. Please see “get- helpabout_signing” for more details.
Fix:
PS C:\Windows\system32> Set-ExecutionPolicyRemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you donot trust. Changing the execution policy mightexpose
you to the security risks described in theabout_Execution_Policies help topic. Do you want to change theexecution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): Y
Policy的有效参数:
— Restricted: 不载入任何配置文件,不运行任何脚本。 “Restricted”是默认的。
— AllSigned: 只有被Trustedpublisher签名的脚本或者配置文件才能使用,包括你自己再本地写的脚本
— RemoteSigned: 对于从Internet上下载的脚本或者配置文件,只有被Trustedpublisher签名的才能使用。
— Unrestricted: 可以载入所有配置文件,可以运行所有脚本文件.如果你运行一个从internet下载并且没有签名的脚本,在运行之前,你会被提示需要一定的权限。
— Bypass: 所有东西都可以使用,并且没有提示和警告.
— Undefined: 删除当前scope被赋予的Execution Policy. 但是Group Policy scope的Execution Policy不会被删除.