C83blog

  • cpe
  • 游戏
    • mc
  • 系统技巧
    • 软件分享
    • 虚拟机
    • win
    • linux
    • 翻墙
  • 维修
  • 未分类
  • 登录
  1. 首页
  2. 系统技巧
  3. linux
  4. 正文

termux 安装linux

2022年9月20日 314点热度 0人点赞 0条评论

https://wiki.termux.com/wiki/PRoot#Installing_Linux_distributions

PRoot

PRoot is a user-space implementation of chroot, mount --bind, and binfmt_misc. This means that users don't need any privileges or setup to do things like using an arbitrary directory as the new root filesystem, making files accessible somewhere else in the filesystem hierarchy, or executing programs built for another CPU architecture transparently through QEMU user-mode.

You can install PRoot with this command:

pkg install proot

Termux maintains its own version of PRoot, which is compatible with the latest Android OS versions. You can find its source code at https://github.com/termux/proot.

Important note: PRoot can make program to appear under root user id due to faking system call arguments and return values, but it does not provide any way for the real privilege escalation. Programs requiring real root access to modify kernel or hardware state will not work.

PRoot vs Chroot

The main different of chroot from PRoot is that it is native. Unlike PRoot, it does not use for hijacking system call arguments and return values to fake the visible file system layout or user/group IDs. It does not cause overhead and works without issues on any device. However it requires superuser permissions. ptrace()

If you have rooted device and want to have a better experience with using the Linux distributions in Termux, then use . In this case get started with Linux Deploy app for automated distribution installation. Things like shell can be used from Termux of course. chroot

General usage information

The main purpose of PRoot is to run the Linux distributions inside Termux without having to root device. Simplest way to start a shell in a distribution chroot is:

unset LD_PRELOAD
proot -r ./rootfs -0 -w / -b /dev -b /proc -b /sys /bin/sh

Where:

  • unset LD_PRELOAD - Termux-exec, execve() hook, conflicts with PRoot.
  • -r ./rootfs - option to specify the rootfs where Linux distribution was installed.
  • -0 - tells PRoot to simulate a root user which expected to be always available in Linux distributions. This option will allow you to use package manager.
  • -b /dev -b /proc -b /sys - make file systems at /dev, /proc, /sys appear in the rootfs. These 3 bindings are important and used by variety of utilities.
  • /bin/sh - a program that should be executed inside the rootfs. Typically a shell.

You can learn more about options supported by PRoot by executing .proot --help

Installing Linux distributions

Termux provides a package proot-distro which takes care of management of the Linux distributions inside Termux. You can install this utility by executing

pkg install proot-distro

For now it supports these distributions:

  • Alpine Linux (edge)
  • Arch Linux / Arch Linux 32 / Arch Linux ARM
  • Debian (stable)
  • Fedora 34
  • OpenSUSE (Tumbleweed)
  • Ubuntu (22.04)
  • Void Linux


To install distribution, just run this command (assuming proot-distro is installed):

proot-distro install <alias>

where "<alias>" should be replaced by chosen distribution, e.g. "alpine". Note that it is expected that you have a stable Internet connection during installation, otherwise download may fail.

After installation, you can start a shell session by executing next command:

proot-distro login <alias>

Here is a basic overview of the available proot-distro functionality:

  • proot-distro list - show the supported distributions and their status.
  • proot-distro install - install a distribution.
  • proot-distro login - start a root shell for the distribution.
  • proot-distro remove - uninstall the distribution.
  • proot-distro reset - reinstall the distribution.


Run for built-in usage information. Note that each of commands (with exception of "list") has own built-in usage information which can be viewed by supplying "--help" as argument. More detailed explanation about available functions you can find at project page: https://github.com/termux/proot-distro#functionality-overviewproot-distro help

Example of installing Debian and launching shell:

proot-distro install debian
proot-distro login debian

Community scripts

The ways of installation of Linux distributions in Termux are not limited to only. There are lots of community created scripts, though their quality may be lower than that of the official Termux utilities provide and third-party stuff is generally out of the official Termux support. proot-distro

Here is the list of some community-provided scripts:

  • Alpine Linux - https://github.com/Hax4us/TermuxAlpine
  • Arch Linux - https://github.com/TermuxArch/TermuxArch
  • Debian - https://github.com/sp4rkie/debian-on-termux
  • Fedora - https://github.com/nmilosev/termux-fedora
  • Kali Nethunter - https://github.com/Hax4us/Nethunter-In-Termux
  • Slackware - https://github.com/gwenhael-le-moine/TermuxSlack
  • Ubuntu - https://github.com/Neo-Oli/termux-ubuntu


If you decide to use third-party scripts, take the responsibility of potential risks on your own.

标签: 暂无
最后更新:2022年11月15日

sydw

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复
最新 热点 随机
最新 热点 随机
中兴F31Pro刷全功能后台保姆级教程 杀死一个已经detached的screen会话 ollama amd ati rx6600使用rocm 在 Termux 中修改 Ollama 的监听地址 termux初始化操作安装debian Debian下的压缩 (zip) 解压缩 (unzip) 命令 screen使用教程 NPS反制之绕过登陆验证 Debian / Ubuntu 手工添加 Swap 分区 frp toml VPS/服务器的下载测速文件 鲲鹏关闭ipv6 ssh版 鲲鹏CPE关闭ipv6 n2n添加联盟 zlt x30 切卡和adb
中兴F31Pro刷全功能后台保姆级教程
Brook端口转发一键脚本 甲骨文 Ubuntu关闭防火墙 sqlite配置下载安装及使用教程 华为AT 改串命令 Linux终端复用神器-Tmux使用梳理 解决screen状态为Attached连上不的问题 bbr一键脚本 美格/品速 CPE 修改 IMEI N2N启动器附加参数 在 Linux 上安装 NetData ollama amd ati rx6600使用rocm 怎么关闭Windows自动更新! 如何在互联网上找到任何软件的注册序列号 获取 VN007+ 原始超密 Debian下的压缩 (zip) 解压缩 (unzip) 命令

COPYRIGHT © 2022 C83blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang