termux
安裝termux
- 手機上下載termux(Android終端仿真器和Linux環境應用程序)
網址: https://f-droid.org/en/packages/com.termux/
- 安裝vim編輯器
pkg install vim #安裝vim
export EDITOR=vim #將vim設置成默認編輯器
apt edit-sources #將里面的網址替換為 https://mirrors.tuna.tsinghua.edu.cn/termux/ 清華源速度快
apt-get update #改變了源,要更新apt的資源列表 apt-get upgrade 是更新系統
- 安裝sudo軟件
pkg install tsu #開始沒有sudo,需要安裝
- 配置ssh
4.1. 查看ip地址
ifconfig #查看linux ip地址,192.168開頭的是ip
4.2. 安裝ssh軟件
pkg install openssh #安裝openssh
passwd #安裝完成配置密碼,輸入兩次
pkg install nmap #安裝nmap
sshd
nmap [ip地址] 上面sshd與nmap來開啟服務
4.3. 用xshell連接
新建會話,名稱隨意,主機就是手機上的ip地址(ifconfig) ,協議ssh, 端口號8022,連接即可.
重啟termux需要重新輸入sshd和nmap命令來開啟ssh服務, 否則無法連接
- 安裝ubuntu
pkg install proot wget -y
pkg installl proot-distro
proot-distro list
這時會列出ubuntu版本
這時我們選 ubuntu-20.04
運行
proot-distro install ubuntu-20.04
安完之后
proot-distro login ubuntu-20.04
就可以運行了,這時運行 ps -a 可以查看進程
- ubuntu安裝mysql
mysql5.7設置密碼:
use mysql;
update user set authentication_string=PASSWORD("密碼") where user='root';
update user set plugin="mysql_native_password";
flush privileges;
quit;
- 內網穿透
https://github.com/fatedier/frp/releases
#免費穿透網址
https://frp.starry.tk/
#b站教程
https://www.bilibili.com/read/cv7512606/