1.安装openssh让电脑可以putty登录
pkg update && pkg upgrade
pkg install openssh
sshd #启动sshd
pkg install proot-distro
2.重置当前用户名密码用于登录
whoami #查找用户名
passwd #改密码
3.此步骤后在电脑使用putty等ssh客户端登录操作
termux-change-repo #换源
4.Termux 在启动时自动运行 sshd
nano ~/.bashrc
#添加下面命令
# 启动 SSH 服务
if ! pgrep -x "sshd" > /dev/null; then
sshd
echo "SSH服务已启动"
else
echo "SSH服务已在运行中"
fi
#在 nano 编辑器中:按 Ctrl+X,然后按 Y,最后按 Enter。
#使配置生效:
source ~/.bashrc
5.使用 PRoot 安装 Debian
pkg install proot-distro
proot-distro list #查看可用的 Linux 发行版
proot-distro install debian #安装 Debian
5.1安装自定义版本
在/data/data/com.termux/files/usr/etc/proot-distro 修改你想要安装的sh脚本
到https://github.com/termux/proot-distro/releases?page=3 复制你想要版本的下载链接
例如:
DISTRO_NAME="Debian"
TARBALL_URL['aarch64']="下载链接"
TARBALL_SHA256['aarch64']="计算sha256"
计算命令 sha256sum 系统压缩包路径 譬如(/data/data/com.termux/files/usr/var/lib/proot-distro/dlcache)
#放在上面的路径命令就不会自己下载
6.登录到 Debian 环境
proot-distro login debian
apt install sudo curl wget #安装常用工具
bash <(curl -sSL https://linuxmirrors.cn/main.sh) #换源
apt update && apt upgrade #更新
7.Debian 主目录位置
/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/debian/
8.其他优化在termux框框输入
termux-wake-lock #保持前台
termux-setup-storage #申请存储权限
8.1其他优化
开发者选项
暂停执行已缓存的应用 停用 了就行,
有两个设置可以防止被k后台
1.电池——高级设置——目标APP——耗电异常优化
改为不优化
2.应用管理——目标APP——耗电行为控制——允许完全后台
文章评论