1.旧手机信息
- nubia Z17 mini 安卓手机
- 安卓版本6.0.1
- 8核 6+64G
2.下载termux工具(可以用笔记本提前下载好,传给手机)
- 安卓上最经典、最强大的Linux环境模拟器,社区资源极其丰富
- github下载地址,可以选择对应的安卓版本的安装包,universal.apk 是通用的包,推荐安装
- https://github.com/termux/termux-app/releases
复制代码
3.手机连接好wifi(重要!!!)
4.将下载好的termux.apk在手机上进行安装
略
5.在手机上安装后打开termux终端,执行初始化操作(都是在手机上的termux中操作)
5.1 安装openssh,方便通过ssh进行远程连接(下载比较慢,需要等会,如果中途出现网络错误,可以ctrl + c 打断,重新执行安装命令)
5.2 设置密码
5.3 启动sshd服务
5.4 查看当前用户,我这边默认输出的用户u0_a116
5.5 查看当前IP地址
5.6 修改默认的ssh端口,默认端口是8022(可选)
- $ vi ~/../usr/etc/ssh/sshd_config
- #最后添加并保存,根据自己需要设定端口
- Port 2222
复制代码 5.7 为了termux程序不被手机后台终止,可以设置后台锁定或者设置手机为常亮模式
6.通过电脑ssh远程连接,之后就可以在电脑上操作了
- [root@localhost ~]# ssh -p 2222 u0_a116@172.16.1.150
复制代码 7.初始化命令操作
7.1 查看当前内核信息
- $ uname -a
- Linux localhost 3.10.84-perf-g1269e29-00269-g112a120 #1 SMP PREEMPT Thu Jun 4 16:40:13 CST 2020 aarch64 Android
复制代码 7.2 安装其他工具命令示范
- # 安装curl命令
- $ pkg install curl
- # 安装nginx服务
- $ pkg install nginx
复制代码 8.安装ubuntu系统
- 在termux的基础上安装ubuntu系统,可以更好的模拟真是操作系统
8.1 安装atilo工具
- # 1. 添加 atilo 的官方仓库源
- echo "deb [trusted=yes arch=all] https://yadominjinta.github.io/files/ termux extras" >> $PREFIX/etc/apt/sources.list.d/atilo.list
- # 2. 更新包列表
- apt update
- # 3. 安装 atilo
- apt install atilo
- # 4. 查看 atilo 支持哪些 Linux 发行版
- atilo images
- # 5. 拉取 Ubuntu容器
- atilo pull ubuntu
- # 6. 进入 Ubuntu 容器
- atilo run ubuntu
复制代码
- 具体的安装过程(下载ubuntu镜像,需要解决安卓手机梯子的问题)
安装ubuntu过程[code]# 更新源$ echo "deb [trusted=yes arch=all] https://yadominjinta.github.io/files/ termux extras" >> $PREFIX/etc/apt/sources.list.d/atilo.list# 更新包列表$ apt updateHit:1 https://termux.dev/game-packages-21-bin games InReleaseHit:2 https://termux.dev/science-packages-21-bin science InReleaseHit:3 https://packages-cf.termux.dev/apt/termux-main-21 stable InReleaseIgn:4 https://yadominjinta.github.io/files termux InReleaseGet:5 https://yadominjinta.github.io/files termux Release [1714 B]Ign:6 https://yadominjinta.github.io/files termux Release.gpgGet:7 https://yadominjinta.github.io/files termux/extras all Packages [688 B]Fetched 2402 B in 33s (72 B/s)Reading package lists... DoneBuilding dependency tree Reading state information... DoneAll packages are up to date.# 安装atilo$ apt install atiloReading package lists... DoneBuilding dependency tree Reading state information... DoneThe following additional packages will be installed: gdbm libffi libsqlite ncurses-ui-libs pythonThe following NEW packages will be installed: atilo gdbm libffi libsqlite ncurses-ui-libs python0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.Need to get 8762 kB of archives.After this operation, 50.5 MB of additional disk space will be used.Do you want to continue? [Y/n] yGet:1 https://packages-cf.termux.dev/apt/termux-main-21 stable/main aarch64 libffi aarch64 3.2.1-5 [20.3 kB]Get:2 https://packages-cf.termux.dev/apt/termux-main-21 stable/main aarch64 libsqlite aarch64 3.30.1-1 [526 kB]Get:3 https://packages-cf.termux.dev/apt/termux-main-21 stable/main aarch64 gdbm aarch64 1.18.1-3 [102 kB]Get:4 https://packages-cf.termux.dev/apt/termux-main-21 stable/main aarch64 ncurses-ui-libs aarch64 6.1.20190511-8 [29.6 kB]Get:5 https://packages-cf.termux.dev/apt/termux-main-21 stable/main aarch64 python aarch64 3.8.0-1 [8080 kB] Get:6 https://yadominjinta.github.io/files termux/extras all atilo all 2.1.0 [4216 B] Fetched 8762 kB in 31s (278 kB/s)Selecting previously unselected package libffi.(Reading database ... 9810 files and directories currently installed.)Preparing to unpack .../0-libffi_3.2.1-5_aarch64.deb ...Unpacking libffi (3.2.1-5) ...Selecting previously unselected package libsqlite.Preparing to unpack .../1-libsqlite_3.30.1-1_aarch64.deb ...Unpacking libsqlite (3.30.1-1) ...Selecting previously unselected package gdbm.Preparing to unpack .../2-gdbm_1.18.1-3_aarch64.deb ...Unpacking gdbm (1.18.1-3) ...Selecting previously unselected package ncurses-ui-libs.Preparing to unpack .../3-ncurses-ui-libs_6.1.20190511-8_aarch64.deb ...Unpacking ncurses-ui-libs (6.1.20190511-8) ...Selecting previously unselected package python.Preparing to unpack .../4-python_3.8.0-1_aarch64.deb ...Unpacking python (3.8.0-1) ...Selecting previously unselected package atilo.Preparing to unpack .../5-atilo_2.1.0_all.deb ...Unpacking atilo (2.1.0) ...Setting up gdbm (1.18.1-3) ...Setting up libsqlite (3.30.1-1) ...Setting up libffi (3.2.1-5) ...Setting up ncurses-ui-libs (6.1.20190511-8) ...Setting up python (3.8.0-1) ...Setting up pip...Looking in links: /data/data/com.termux/files/usr/tmp/tmpbw1k4x0bCollecting setuptoolsCollecting pipInstalling collected packages: setuptools, pipSuccessfully installed pip-19.2.3 setuptools-41.2.0Setting up atilo (2.1.0) ...Collecting requests Downloading https://files.pythonhosted.org/packages/7c/e4/56027c4a6b4ae70ca9de302488c5ca95ad4a39e190093d6c1a8ace08341b/requests-2.32.4-py3-none-any.whl (64kB) |████████████████████████████████| 71kB 247kB/s Collecting tqdm Downloading https://files.pythonhosted.org/packages/16/e1/3079a9ff9b8e11b846c6ac5c8b5bfb7ff225eee721825310c91b3b50304f/tqdm-4.67.3-py3-none-any.whl (78kB) |████████████████████████████████| 81kB 950kB/s Collecting PTable Downloading https://files.pythonhosted.org/packages/ab/b3/b54301811173ca94119eb474634f120a49cd370f257d1aae5a4abaf12729/PTable-0.9.2.tar.gzCollecting charset_normalizer=2 (from requests) Downloading https://files.pythonhosted.org/packages/2a/68/687187c7e26cb24ccbd88e5069f5ef00eba804d36dde11d99aad0838ab45/charset_normalizer-3.4.6-py3-none-any.whl (61kB) |████████████████████████████████| 71kB 1.6MB/s Collecting idna=2.5 (from requests) Downloading https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl (71kB) |████████████████████████████████| 71kB 1.4MB/s Collecting certifi>=2017.4.17 (from requests) Downloading https://files.pythonhosted.org/packages/9a/3c/c17fb3ca2d9c3acff52e30b309f538586f9f5b9c9cf454f3845fc9af4881/certifi-2026.2.25-py3-none-any.whl (153kB) |████████████████████████████████| 163kB 8.9MB/s Collecting urllib3=1.21.1 (from requests) Downloading https://files.pythonhosted.org/packages/ce/d9/5f4c13cecde62396b0d3fe530a50ccea91e7dfc1ccf0e09c228841bb5ba8/urllib3-2.2.3-py3-none-any.whl (126kB) |████████████████████████████████| 133kB 878kB/s Installing collected packages: charset-normalizer, idna, certifi, urllib3, requests, tqdm, PTable Running setup.py install for PTable ... doneSuccessfully installed PTable-0.9.2 certifi-2026.2.25 charset-normalizer-3.4.6 idna-3.11 requests-2.32.4 tqdm-4.67.3 urllib3-2.2.3WARNING: You are using pip version 19.2.3, however version 25.0.1 is available.You should consider upgrading via the 'pip install --upgrade pip' command.# 查看atilo支持哪些linux发行版$ atilo images+----------+---------+-----------+-------------+| Name | Version | Installed | Installable |+----------+---------+-----------+-------------+| alpine | 3.12 | False | True || centos | 8.1 | False | True || debian | 10 | False | True || fedora | 33 | False | True || kali | latest | False | True || opensuse | 15.2 | False | True || ubuntu | focal | False | True |+----------+---------+-----------+-------------+# 拉取ubuntu镜像(由于连接的是github,所以需要梯子,在手机上自行解决梯子问题)$ atilo pull ubuntuCant connect to GitHub. A Proxy may be needed.# 继续拉取ubuntu镜像$ atilo pull ubuntuPulling image100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 26.3M/26.3M [00:05 |