Android - Termux

  1. 下载
  2. 配置
    1. 环境变量
    2. 切换国内源
    3. 开启ssh
  3. 搭建服务
    1. Home Assistant Core
  4. 参考

下载

Github Releases
F-Droid

配置

环境变量

变量名
ANDROID_ART_ROOT /apex/com.android.art
ANDROID_ASSETS /system/app
ANDROID_DATA /data
ANDROID_I18N_ROOT /apex/com.android.i18n
ANDROID_ROOT /system
ANDROID_STORAGE /storage
ANDROID_TZDATA_ROOT /apex/com.android.tzdata
ASEC_MOUNTPOINT /mnt/asec
BOOTCLASSPATH /apex/com.android.art/javalib/core-oj.jar:/apex/com.android.art/javalib/core-libart.jar:/apex/com.android.art/javalib/core-icu4j.jar:/apex/com.android.art/javalib/okhttp.jar:/apex/com.android.art/javalib/bouncycastle.jar:/apex/com.android.art/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/framework-atb-backward-compatibility.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar:/apex/com.android.mediaprovider/javalib/framework-mediaprovider.jar:/apex/com.android.os.statsd/javalib/framework-statsd.jar:/apex/com.android.permission/javalib/framework-permission.jar:/apex/com.android.sdkext/javalib/framework-sdkextensions.jar:/apex/com.android.wifi/javalib/framework-wifi.jar:/apex/com.android.tethering/javalib/framework-tethering.jar
DEX2OATBOOTCLASSPATH /apex/com.android.art/javalib/core-oj.jar:/apex/com.android.art/javalib/core-libart.jar:/apex/com.android.art/javalib/core-icu4j.jar:/apex/com.android.art/javalib/okhttp.jar:/apex/com.android.art/javalib/bouncycastle.jar:/apex/com.android.art/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/framework-atb-backward-compatibility.jar
EXTERNAL_STORAGE /sdcard
HISTCONTROL ignoreboth
HOME /data/data/com.termux/files/home
LANG en_US.UTF-8
LD_PRELOAD /data/data/com.termux/files/usr/lib/libtermux-exec.so
LOGNAME u0_a168
OLDPWD
PATH /data/data/com.termux/files/usr/bin
PREFIX /data/data/com.termux/files/usr
PWD /data/data/com.termux/files/home
SHELL /data/data/com.termux/files/usr/bin/bash
SHLVL 1
SSH_CLIENT 192.168.0.46 54818 54321
SSH_CONNECTION 192.168.0.46 54818 192.168.0.162 54321
SSH_TTY /dev/pts/3
SYSTEMSERVERCLASSPATH /system/framework/org.lineageos.platform.jar:/system/framework/com.android.location.provider.jar:/system/framework/services.jar:/system/framework/ethernet-service.jar:/apex/com.android.permission/javalib/service-permission.jar:/apex/com.android.ipsec/javalib/android.net.ipsec.ike.jar
TERM xterm-256color
TERMUX_APP__AM_SOCKET_SERVER_ENABLED true
TERMUX_APP__APK_PATH /data/app/~~o6Cz0_shB9zIkwYvAqiIeA==/com.termux-vHUlziNokj8WGvBmtdgimQ==/base.apk
TERMUX_APP__APK_RELEASE UNKNOWN
TERMUX_APP__FILES_DIR /data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD false
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE false
TERMUX_APP__PACKAGE_MANAGER apt
TERMUX_APP__PACKAGE_NAME com.termux
TERMUX_APP__PACKAGE_VARIANT apt-android-7
TERMUX_APP__PID 25881
TERMUX_APP__SE_FILE_CONTEXT u:object_r:app_data_file:s0:c168,c256,c512,c768
TERMUX_APP__SE_INFO default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT u:r:untrusted_app_27:s0:c168,c256,c512,c768
TERMUX_APP__TARGET_SDK 28
TERMUX_APP__UID 10168
TERMUX_APP__USER_ID 0
TERMUX_APP__VERSION_CODE 118
TERMUX_APP__VERSION_NAME 0.118.0
TERMUX_MAIN_PACKAGE_FORMAT debian
TERMUX_VERSION 0.118.0
TMPDIR /data/data/com.termux/files/usr/tmp

切换国内源

开启ssh

  1. 更新Termux环境
    pkg upgrade -y
    
  2. 安装openssh
    pkg install openssh
    
  3. 查看当前用户名
    whoami
    
  4. 设置当前用户的密码
    passwd
    
  5. 修改sshd_config
    echo -e "Port 54322\nListenAddress 0.0.0.0" >> ${PREFIX}/etc/ssh/sshd_config
    
  6. 启动ssh
    sshd
    

搭建服务

Home Assistant Core

P.S. 以下内容编写时Home Assistant Core版本为2024.8.3,由于Home Assistant更新速度太快,不保证其有效性

  1. 更新Termux环境
    pkg upgrade -y
    
  2. 安装proot
    pkg install proot proot-distro
    
  3. proot下安装并登录Debian
    proot-distro install debian
    
    proot-distro login debian
    
  4. 更新Debian系统
    apt update && apt full-upgrade -y
    
  5. 安装构建依赖
    apt install 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 libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libswresample-dev libopenblas-dev cargo cmake ninja-build pkg-config
    
  6. 创建Python虚拟环境
    python3 -m venv homeassistant
    
  7. 激活Python虚拟环境
    source homeassistant/bin/activate
    
  8. 安装homeassistant
    pip install homeassistant
    
  9. 启动
    hass
    

参考


Linux - Home Assistant
Homeassistant core on android - Installation - Home Assistant Community


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 cnlnnn@qq.com

文章标题:Android - Termux

字数:925

本文作者:cnlnn

发布时间:2024-08-23, 11:53:00

最后更新:2024-10-06, 14:21:44

原始链接:https://cnlnn.pages.dev/posts/null/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。