termux下,使用debootstrap命令安装debian的方法

termux下,使用debootstrap命令安装debian的方法

termux安装debian有了新方法,不是proot-distro,也不是anlinux,而是用deboogstrap

一 网上找到的debootstrap命令行说明

sudo debootstrap –arch |平台| |发行版本代号| |目录| |安装源|
debian12的版本代号叫 Bookworm
debian10的版本代号叫 Buster

1
2
3
4
# 基本命令行
$ pkg install debootstrap proot wget
$ uname -m # 获取CPU平台的架构
$ debootstrap --arch=ARCH stable stable /debian/
二 入坑

uname -m 后显示aarch64, 然后

1
2
3
4
5
6
7
8
9
10
$ debootstrap --arch aarch64 buster debian  https://mirrors.tuna.tsinghua.edu.cn/debian/
# 一直报错
# 后来把aarch64改为arm64,成功

# 安装 debian10成功
$ debootstrap --arch arm64 buster debian http://mirrors.tuna.tsinghua.edu.cn/debian

# 安装 debian12成功
debootstrap --arch arm64 bookworm debian12 http://mirrors.tuna.tsinghua.edu.cn/debian

三 安装后的使用
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 上一频在 ~/debian12下安装了代号为bootworm的debian12
$ mkdir shm
$ vim start-debian12.sh
# 内容如下

#!/data/data/com.termux/files/usr/bin/bash
cd $(dirname $0)
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r debian12"
if [ -n "$(ls -A ubuntu-binds)" ]; then
for f in ubuntu-binds/* ;do
. $f
done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b debian12/root:/dev/shm"
## uncomment the following line to have access to the home directory of termux
#command+=" -b /data/data/com.termux/files/home:/root"
## uncomment the following line to mount /sdcard directly to /
command+=" -b /sdcard"
command+=" -w /root"
command+=" -b /storage"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=$TERM"
command+=" LANG=C.UTF-8"
command+=" /bin/bash --login"
com="$@"
if [ -z "$1" ];then
exec $command
else
$command -c "$com"
fi

保存退出后,以后只要执行 bash start-debian12.sh就可进入debian了

四 安装mate-destop
1
2
3
4
$ apt install mate-desktop mate-core mate-indicator-applet -y
$ apt install mate-desktop-environment -y # 基准版
$ apt install mate-desktop-environment-extras -y #完全版

好象这样装后debian,己经把vnc完全装好了,所以 ./vcn/xstartup最后一行启动mate,要改成
~~ mate-session ~~