ha_install.sh脚本下载自动安装homeassistant智能家居脚本下载

2022-09-05
0评论
/
466阅读
爱搜啊

Homeassistant 能做什么

最早接触的 Homeassistnt (下简称HA)是为了把米家设备接入 Homekit 用 Siri 和自动化管理设备。随着 HA 的版本迭代,HA 越来越稳定与个性化。HA 不光是连接 Homekit 和智能家居的桥梁,更是让家居更适应你需求的管理中心。

ha_install.sh脚本

以下为脚本“ha_install.sh”的内容,自动安装homeassistant脚本下载。

也可以新建ha_install.sh,然后复制以下内容粘贴进去,上传到路由器的ROOT文件夹

#!/bin/bash
echo -e '\033[5;32m本脚本用来安装haproxy \033[0m'
echo -e '\033[5;32m 请把软件包放在/root/目录下或者wget下载\033[0m'
systemctl  stop firewalld
systemctl  disable firewalld
setenforce 0
sed -i '/SELINUX=/s/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
mkdir -p  /opt/haproxy/conf
mkdir -p /etc/haproxy
mkdir -p  /opt/haproxy/logs
cd && wget http://www.haproxy.org/download/1.7/src/haproxy-1.7.5.tar.gz #下载安装包,可以替换成自己的版本
ls /root/haproxy*.tar.gz 
if [ $? -eq 0 ];then
ln -s /opt/haproxy/conf/haproxy.cfg /etc/haproxy/haproxy.cfg
cd /root/
tar -zxvf haproxy-1.7.5.tar.gz
cp -r /root/haproxy-1.7.5/examples/errorfiles /opt/haproxy/errorfiles
ln -s  /opt/haproxy/errorfiles  /etc/haproxy/errorfiles
touch /opt/haproxy/logs/haproxy.log
ln -s /opt/haproxy/logs/haproxy.log /var/log/haproxy.log
cp /root/haproxy-1.7.5/examples/haproxy.init /etc/rc.d/init.d/haproxy
chmod +x  /etc/rc.d/init.d/haproxy
chkconfig --level 2345 haproxy on
ln -s /opt/haproxy/sbin/haproxy /usr/sbin
sed -i '/#$ModLoad imudp/s/#$ModLoad imudp/$ModLoad imudp/' /etc/rsyslog.conf
sed -i '/$UDPServerRun 514/s/#$UDPServerRun 514/$UDPServerRun 514/' /etc/rsyslog.conf
echo 'local0.*  /var/log/haproxy.log ' >> /etc/rsyslog.conf
sed -i '/SYSLOGD_OPTIONS=/s/SYSLOGD_OPTIONS=.*/SYSLOGD_OPTIONS="-r -m 0 -c 2"/' /etc/sysconfig/rsyslog
yum -y install  pcre* pcre-devel GeoIP gd libXpm  ncurses-devel perl make gcc gcc-c++ ncurses-devel zlib zlib-devel openssl*
cd /root/haproxy-1.7.5/
make TARGET=linux2628 USE_STATIC_PCRE=1 USE_REGPARM=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1 USE_ZLIB=1 ARCH=x86_64
ldd haproxy | grep ssl
make install PREFIX=/opt/haproxy
fi
echo 'global
        log     127.0.0.1       local0
        maxconn 65535
        pidfile /var/run/haproxy.pid
        nbproc  1
        daemon
        ulimit-n                819200
        tune.ssl.default-dh-param               2048
defaults
        mode            http
        log             global
        option          httplog
        option          redispatch
        option          dontlognull
        option          httpclose
        option          forwardfor
        maxconn         65535
        balance         source
        retries         5
        timeout         connect         5000
        timeout         client          3600000
        timeout         server          3600000
        timeout         check           10s
        timeout         http-request    20s
        timeout         queue           1m
        timeout         http-keep-alive 20s
listen admin_status
        mode    http
        bind    *:8080
        stats   uri             refresh 30s
        stats   uri             /status
        stats   realm           status
        stats   auth            admin:Iv0011.net!
        stats   hide-version' > /opt/haproxy/conf/haproxy.cfg
systemctl start haproxy 
systemctl restart rsyslog.service
ss -tnulp |grep haproxy
echo -e '\033[33m 验证haproxy是否成功安装请访问127.0.0.1:8080/status \033[0m'

自动安装homeassistant智能家居脚本下载


本站附件分享,如果附件失效,可以去找找看

诚通网盘附件百度网盘附件


于2022-09-05发布