安卓手机上通过Termux运行Linux系统

介绍

Termux是一个适用于 Android 的终端模拟器,其环境类似于 Linux 环境。 无需Root或设置即可使用。 Termux 会自动进行最小安装 - 使用 APT 包管理器即可获得其他软件包。

官网:https://termux.dev/​

GitHub:https://github.com/termux/termux-app

下载安装

通过F-droid下载

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

通过GitHub下载

地址:https://github.com/termux/termux-app/releases/

换源

参考:https://help.mirrors.cernet.edu.cn/termux/

安装需要的包

pkg install vim proot-distro -y

​pkg install vim proot-distro -y

下载并运行Debian

输入proot-distro list查看可安装的系统

proot-distro list

输出示例如下:

~ $ proot-distro list

 

Supported distributions:

 

  * Alpine Linux

 

    Alias: alpine

    Installed: no

    Comment: Rolling release branch (edge).

 

  * Arch Linux

 

    Alias: archlinux

    Installed: no

    Comment: Currently available only AArch64 and ARM ports.

 

  * Artix Linux

 

    Alias: artix

    Installed: no

    Comment: Currently available only for AArch64.

 

  * Debian (bookworm)

 

    Alias: debian

    Installed: no

    Comment: Stable release.

 

  * Debian (bullseye)

 

    Alias: debian-oldstable

    Installed: no

    Comment: Old stable release.

 

  * deepin

 

    Alias: deepin

    Installed: no

    Comment: Supports only 64-bit CPUs.

 

  * Fedora

 

    Alias: fedora

    Installed: no

    Comment: Version 40. Supports only 64-bit CPUs.

 

  * Manjaro

 

    Alias: manjaro

    Installed: no

    Comment: Currently available only for AArch64.

 

  * OpenKylin

 

    Alias: openkylin

    Installed: no

    Comment: Version 'nile'. Supports only 64-bit CPUs.

 

  * OpenSUSE

 

    Alias: opensuse

    Installed: no

    Comment: Rolling release (Tumbleweed).

 

  * Pardus

 

    Alias: pardus

    Installed: no

    Comment: Version 'yirmibir'. Not available for ARM 32 bit.

 

  * Ubuntu (24.04)

 

    Alias: ubuntu

    Installed: no

    Comment: LTS release (noble). Not available for x86 32-bit (i686) CPUs.

 

  * Ubuntu (22.04)

 

    Alias: ubuntu-oldlts

    Installed: no

    Comment: Previous LTS release (jammy). Not available for x86 32-bit (i686) CPUs.

 

  * Void Linux

 

    Alias: void

    Installed: no

 

Install selected one with: proot-distro install <alias>

 

安装

proot-distro install debian

proot-distro install debian

 

然后经历漫长的等待后安装成功。

大概这个样子: 

24c788152ff44bec99418187ee0bdb7d.jpg

 

使用

进入

proot-distro login debian

proot-distro login debian

输出:

~ $ proot-distro login debian

root@localhost:~# 

换源

进入后,参考:https://help.mirrors.cernet.edu.cn/debian/

退出

exit

exit

输出:

root@localhost:~# exit

logout

~ $

打开时自动进入

编辑“$PREFIX/etc/profile.d/启动Debian.sh”

echo '#!/data/data/com.termux/files/usr/bin/bash

proot-distro login debian' > $PREFIX/etc/profile.d/启动Debian.sh

echo '#!/data/data/com.termux/files/usr/bin/bash

proot-distro login debian' > $PREFIX/etc/profile.d/启动Debian.sh

备份与还原

备份到Debian.tar.gz

proot-distro backup debian --output Debian.tar.gz

proot-distro backup debian --output Debian.tar.gz

通过Debian.tar.gz还原

proot-distro restore Debian.tar.gz

proot-distro restore Debian.tar.gz

 

 

 

 

  • 24
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值