termux使用指南

2021-07-15

官网:https://termux.com/

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.


不需要root即可直接将自己的安卓机化身一台linux服务器。

 

1. 文件映射

 termux-setup-storage 

~/ 是 /data/data/com.termux/files/home

允许文件访问权限后,会在~./下新建一个storage文件夹

其下有 downloads指向 /storage/emulated/0/Download

pictures -> /storage/emulated/0/Pictures

dcim -> /storage/emulated/0/DCIM

 shared -> /storage/emulated/0

echo $PREFIX

本机储存卡:

ls /sdcard

2. 换源

推介清华源:https://mirrors.tuna.tsinghua.edu.cn/help/termux/

https://mirrors.ustc.edu.cn/help/termux.html

先找源
termux-chan

/

cd $PREFIX
echo "deb https://mirrors.tuna.tsinghua.edu.cn/termux stable main" > etc/apt/sources.list



echo "deb https://mirrors.ustc.edu.cn/termux/apt/termux-main stable main" > etc/apt/sources.list

 

 

3. 安装ssh

pkg install openssh

sshd
passwd

ssh ip地址 -p 8022

配置只允许秘钥登录


$PREFIX/etc/ssh/sshd_config

rintMotd yes
PasswordAuthentication no
Subsystem sftp /data/data/com.termux/files/usr/libexec/sftp-server

再编辑~/.ssh/下配置文件

4. frp

https://github.com/fatedier/frp/releases
https://github.com/fatedier/frp/releases/download/v0.37.0/frp_0.37.0_linux_arm64.tar.gz

5. wget

pkg install wget

6. git

pkg install git

7. 关于@PREFIX

vim @PREFIX/etc/ssh/............

 

 

 

备份升级

https://wiki.termux.com/wiki/Backing_up_Termux