Termux 0.118 版本安装 Linux

1. 前提

目前据我所知的安装Linux方法有两种,这边笔者介绍安装Alpine Linux。

2. 通过 proot-distro 安装 Alipine Linux

  1. 安装proot
$ pkg install proot
  1. 安装proot-distro

Android 5.0下的 Termux 源里没有proot-distro,所以需要手动安装proot-distro,可能是因为0.118版本的Termux没有做太多适配,导致后面系统兼容性有些问题,不过能正常使用。

proot-distro 开源地址: https://github.com/termux/proot-distro

通过下面的命令安装:

$ pkg install git
$ git clone https://github.com/termux/proot-distro
$ cd proot-distro
$ ./install.sh
  1. 安装Alpine Linux
  • 通过proot-distro list 查看当前支持并且可以安装的Linux
$ proot-distro list 

Supported distributions:

  * Alpine Linux

    Alias: alpine
    Status: NOT installed
    Comment: Rolling release branch (edge).

  * Arch Linux

    Alias: archlinux
    Status: NOT installed
    Comment: Currently available only AArch64 and ARM ports.

  * Debian

    Alias: debian
    Status: NOT installed
    Comment: A stable release (bullseye).
.....
  • 通过proot-distro install <Alias> 命令安装对应的Linux版本

下载这一步拿梯子会下的快一点,不然比较慢,但是还能接受,因为Alpine系统出了名的小。

$ proot-distro install alpine
  • 下载完成后 proot-distro login alpine进入Alpine Linux 系统
$ proot-distro login alpine

localhost:~#

问题:Android 5.0 下的0.118版本会出现下面的错误```shell
proot error: unknown option ‘–sysvipc’.
fatal error: see proot --help.

解决方法:
启动时加上`--no-sysvipc`参数
```shell
$ proot-distro login alpine --no-sysvipc

localhost:~#

3. 安装大佬打包的 Alpine Linux

项目地址:https://github.com/Hax4us/TermuxAlpine

  1. 首先安装git
$ pkg install git
  1. 安装方法很简单,只要通过整合的代码一键运行就能安装了。
$ cd $HOME
$ git clone https://github.com/Hax4us/TermuxAlpine.git
$ cd TermuxAlpine
$ chmod 777 TermuxAlpine.sh
$ ./TermuxAlpine.sh

等待片刻,出现下面的界面说明安装完成

 #------------------------------------------#

 Now you can enjoy a very small (just 1 MB!) Linux environment in your Termux :)
 Don't forget to star my work

 #------------------------------------------#

 #------------------------------------------#

 [*] Email   :    lkpandey950@gmail.com
 [*] Website :    https://hax4us.com
 [*] YouTube :    https://youtube.com/hax4us

 #------------------------------------------#

 NOTE :  use --uninstall option for uninstall

 #------------------------------------------#

上面介绍到了通过startalpine --uninstall可以卸载alpine

  1. 安装完成后运行 startalpine就能进入系统
$ startalpine

$ exit # 退出系统
  1. 进入系统后更新源,这时候在alpine环境里。
$ apk update
  1. 配置Alpine源

alpine 源文件存在 /etc/apk/repositories目录下,直接修改这里面的文件地址

$ vi /etc/apk/repositories

替换文件里的源为

http://mirrors.aliyun.com/alpine/v3.12/main
http://mirrors.aliyun.com/alpine/v3.12/community

换过源以后需要更新源

$ apk update && apk upgrade

4. 安装Ubuntu

1. termux-ubuntu(Android 7.0 无法启动)

https://github.com/Neo-Oli/termux-ubuntu
安装步骤:

  • 安装必备依赖
$ pkg install wget proot git
  • 克隆代码安装ubuntu

$ git clone https://github.com/Neo-Oli/termux-ubuntu.git
$ cd termux-ubuntu
$ bash ubuntu.sh
$ ./start-ubuntu.sh

运行./start-ubuntu.sh的时候出现下面的问题

$./start-ubuntu.sh
proot warning: can't chdir("/root/.") in the guest rootfs: No such file or directory
proot info: default working directory is now "/"
proot error: '/usr/bin/env' not found (root = /data/data/com.termux/files/home/termux-ubuntu/ubuntu-fs, cwd = /, $PATH=(null))
fatal error: see `proot --help`.

解决方案就是安装下面的项目:https://github.com/Neo-Oli/termux-ubuntu/issues/127#issuecomment-630208350

2. ubuntu-in-termux(Android7.0 19.10版本apt 有各种问题,20.04.3分支没问题)

https://github.com/MFDGaming/ubuntu-in-termux
安装步骤:

  • 更新Termux
$ pkg update && pkg upgrade -y
  • 安装依赖
$ pkg install wget proot git 
  • 安装ubuntu
$ git clone https://github.com/MFDGaming/ubuntu-in-termux.git
$ cd ubuntu-in-termux
$ chmod +x ubuntu.sh
$ ./ubuntu.sh -y
$ ./startubuntu.sh

成功安装Ubuntu

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

锡城筱凯

你的鼓励是我创造的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值