termux-安装 可拿旧手机当服务器

termux

安装termux

  1. 手机上下载termux(Android终端仿真器和Linux环境应用程序)

网址: https://f-droid.org/en/packages/com.termux/

  1. 安装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 是更新系统

  1. 安装sudo软件

pkg install tsu #开始没有sudo,需要安装

  1. 配置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服务, 否则无法连接

  1. 安装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 可以查看进程

  1. 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;

  1. 内网穿透

https://github.com/fatedier/frp/releases

#免费穿透网址

https://frp.starry.tk/

#b站教程

https://www.bilibili.com/read/cv7512606/

 
posted @ 2021-10-23 09:19  JS脚本  阅读(894)  评论(0编辑  收藏  举报