Termux在Andriod安装centos

本文档详细介绍了如何在Android设备上使用Termux安装和配置SSH,以及如何通过SSH远程连接到手机。此外,还展示了如何在Termux环境中安装CentOS,包括配置Proot、下载和启动CentOS的步骤。整个过程旨在提供一个在移动设备上使用Linux环境的便捷途径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、下载Termux

1、下载地址:https://f-droid.org/repo/com.termux_106.apk
2、在手机端进行安装。

二、配置ssh,使用pc远程操作

1、更新软件源,使用命令替换为清华源镜像(这里没替换,是在pc连接后才换的)。卡住了就按回车。

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

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

在这里插入图片描述

2、安装openssh-server

pkg install openssh

在这里插入图片描述

3、设置ssh连接密码

$passwd

#根据提示设置一个密码
New password:

在这里插入图片描述

4、查看手机ip,远程连接ip(192.168.x.x,以192.168开头);查看用户。

ifconfig

在这里插入图片描述

whoami

在这里插入图片描述
5、重启ssh连接

sshd &

在这里插入图片描述

6、pc端创建ssh会话连接,端口号8022
在这里插入图片描述
7、挂载储存卡,使得可以用cd命令访问文件目录

termux-setup-storage 

8、修改Termux的问候语,测试pc对手机的操作是否成功。

(1)安装vim(如果出现问题,说明清华源没有修改成功,去修改更新)

 pkg install vim

(2)修改问候语(手机端执行命令,粘贴banner图)

 vim $PREFIX/etc/motd

在这里插入图片描述

三、安装centos

1、配置proot,用于模拟sudo权限

pkg install proot
termux-chroot

2、配置wget,用来下载文件

pkg install wget

3、安装centos命令(龟速等待安装下载中······)----=-=-==–【也可以使用Anlinux软件复制命令进行安装】

mkdir CentOS && cd CentOS && pkg install wget openssl-tool proot -y && hash -r && wget https://raw.fastgit.org/EXALAB/AnLinux-Resources/master/Scripts/Installer/CentOS/centos.sh && sed -i 's/githubusercontent.com/fastgit.org/' centos.sh && bash centos.sh && rm centos.sh

附,若安装图形界面linux系统Ubuntu,则使用以下命令

mkdir Ubuntu && cd Ubuntu && pkg install wget openssl-tool proot -y && hash -r && wget https://raw.fastgit.org/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh && sed -i 's/githubusercontent.com/fastgit.org/' ubuntu.sh && bash ubuntu.sh && rm ubuntu.sh

4、启动centos,进入目录启动centos

ls
./start-centos.sh
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值