本文主要是介绍极致安卓之—Termux安装Linux(超简易),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
系列文章目录
嵌入式开发之初学shell(1)
在ubuntu20.04下搭建lamp环境并制作静态网页
文章目录
- 系列文章目录
- 前言
- 一、Termux是什么?
- 二、操作步骤
- 1.安装Termux
- 2.update && upgrade
- 3.替换镜像源
- 4.安装基础件proot-distro
- 5.查看可以可安装的Linux系统
- 6.选择需要的linux系统安装(本次选择Ubuntu)
- 总结
前言
Termux 基本实现 Linux 下的许多基本操作。可以使用 Termux 安装 python,并实现 python 编程,可以用手机架设 Server,同样可以用于渗透测试等等。
一、Termux是什么?
Termux 是 Android 平台上的一个终端模拟器,它将众多 Linux 上运行的软件和工具近乎完美的移植到了手机端。
无需任何复杂的安装和配置过程,软件装好以后即会自动配置一个基本的运行环境,用以执行一些常见的 Linux 命令。
最为关键的是,它还内置了功能健全的包管理工具,可以使用类似于 Ubuntu 系统的 apt (或 pkg)命令安装额外的软件包。
二、操作步骤
1.安装Termux
链接:https://developer.android.google.cn/distribute/google-play/
下载-安装-运行
Welcome to Termux!Community forum: https://termux.com/community
Gitter chat: https://gitter.im/termux/termux
IRC channel: #termux on libera.chatWorking with packages:* Search packages: pkg search <query>* Install a package: pkg install <package>* Upgrade packages: pkg upgradeSubscribing to additional repositories:* Root: pkg install root-repo* X11: pkg install x11-repoReport issues at https://termux.com/issues
2.update && upgrade
代码如下(示例):
~ $ apt update
~ $ apt upgrade
After this operation, 3322 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
该处键入y继续
3.替换镜像源
如果是国外的源,也就是我们需要去访问国外的服务器来更新包,访问速度是非常慢的。替换镜之后安装软件更快,之前都是几十KB每秒,替换过后就是几MB每秒。替换镜像源可以使得安装速度变快,成功率提高,这里选择清华大学镜像源:
~ $ sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/termux-packages-24 stable main@' $PREFIX/etc/apt/sources.list
~ $ sed -i 's@^\(deb.*games stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/game-packages-24 games stable@' $PREFIX/etc/apt/sources.list.d/game.list
```c
~ $ sed -i 's@^\(deb.*science stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/science-packages-24 science stable@' $PREFIX/etc/apt/sources.list.d/science.list
全部执行完后更新
~ $ apt update
4.安装基础件proot-distro
~ $ pkg install tsu
效果如下:
Checking availability of current mirror: ok
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:tsu
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 4508 B of archives.
After this operation, 57.3 kB of additional disk space will be used.
Get:1 https://packages.termux.org/apt/termux-main stable/main aarch64 tsu all 8.6.0 [4508 B]
Fetched 4508 B in 1s (3903 B/s)
Selecting previously unselected package tsu.
(Reading database ... 4158 files and directories currently installed.)
Preparing to unpack .../apt/archives/tsu_8.6.0_all.deb ...
Unpacking tsu (8.6.0) ...
Setting up tsu (8.6.0) ...
~ $ pkg install tsu
Checking availability of current mirror: ok
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
tsu is already the newest version (8.6.0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5.查看可以可安装的Linux系统
~ $ proot-distro list
可以看到:
Supported distributions:* Alpine Linux (edge)Alias: alpineStatus: NOT installed* Arch LinuxAlias: archlinuxStatus: NOT installed* Debian (bullseye)Alias: debianStatus: NOT installed* Fedora (35)Alias: fedoraStatus: NOT installed* Manjaro AArch64Alias: manjaro-aarch64Status: NOT installedComment: Only for AArch64 hosts.* OpenSUSE (Tumbleweed)Alias: opensuseStatus: NOT installed* Ubuntu (impish)Alias: ubuntuStatus: NOT installed* Void LinuxAlias: voidStatus: NOT installedInstall selected one with: proot-distro install <alias>
6.选择需要的linux系统安装(本次选择Ubuntu)
~ $ proot-distro install ubuntu
可以看到:
[*] Installing Ubuntu (impish)...
[*] Creating directory '/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu'...
[*] Creating directory '/data/data/com.termux/files/usr/var/lib/proot-distro/dlcache'...
[*] Downloading rootfs tarball...% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed0 0 0 0 0 0 0 0 --:--:-- --:- 0 0 0 0 0 0 0 0 --:--:-- --:-100 670 100 670 0 0 788 0 --:--:-- --:--:-- --:--:-- 7890 0 0 0 0 0 0 0 --:--:-- 0:0 0 31.4M 0 159k 0 0 72738 0 0:07:33 0:0 6 31.4M 6 1935k 0 0 597k 0 0:00:53 0:0 14 31.4M 14 4751k 0 0 1119k 0 0:00:28 0:0 23 31.4M 23 7648k 0 0 1457k 0 0:00:22 0:0 33 31.4M 33 10.4M 0 0 1707k 0 0:00:18 0:0 44 31.4M 44 13.8M 0 0 1962k 0 0:00:16 0:0 51 31.4M 51 16.2M 0 0 2020k 0 0:00:15 0:0 60 31.4M 60 18.9M 0 0 2101k 0 0:00:15 0:0 72 31.4M 72 22.7M 0 0 2271k 0 0:00:14 0:0 83 31.4M 83 26.2M 0 0 2389k 0 0:00:13 0:0 97 31.4M 97 30.8M 0 0 2578k 0 0:00:12 0:0100 31.4M 100 31.4M 0 0 2560k 0 0:00:12 0:00:12 --:--:-- 3582k[*] Checking integrity, please wait...
[*] Extracting rootfs, please wait...
[*] Writing '/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/etc/profile.d/termux-proot.sh'...
[*] Writing resolv.conf file (NS 1.1.1.1/1.0.0.1)...
[*] Writing hosts file...
[*] Registering Android-specific UIDs and GIDs...
[*] Running distro-specific configuration steps...
gvfs-daemons set on hold.
udisks2 set on hold.
[*] Installation finished.
Now run 'proot-distro login ubuntu' to log in.
如果此时再次输入~ $ proot-distro list 可以看到对应的版本已经安装。
- 至此我们在手机上安装linux就完成了,后面可以继续安装图形化界面(安装VNC viewer)
总结
- 要更换国内镜像源,保下载安装过程的稳定性。
- 安装过程中不要切换界面,以免安装失败。
参考链接:
https://www.csdn.net/tags/Mtzakg1sMjA1MjMtYmxvZwO0O0OO0O0O.html
https://blog.csdn.net/weixin_47715368/article/details/123602016?spm=1001.2014.3001.5501
这篇关于极致安卓之—Termux安装Linux(超简易)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!