Termux安裝與使用
Termux 是運(yùn)行在 Android 上的 terminal霍殴。不需要root,運(yùn)行于內(nèi)部存儲(chǔ),自帶了一個(gè)包管理器铺呵,可以安裝許多現(xiàn)代化的開(kāi)發(fā)和系統(tǒng)維護(hù)工具吉挣。
下載與安裝(官網(wǎng))
Termux | F-Droid - Free and Open Source Android App Repository
配置
1.替換國(guó)內(nèi)源
圖形界面(TUI)替換
在較新版的 Termux 中派撕,官方提供了圖形界面(TUI)來(lái)半自動(dòng)替換鏡像,推薦使用該種方式以規(guī)避其他風(fēng)險(xiǎn)睬魂。 在 Termux 中執(zhí)行如下命令
termux-change-repo
在圖形界面引導(dǎo)下终吼,使用自帶方向鍵可上下移動(dòng)。
2.安裝完整的Linux子系統(tǒng)
安裝proot-distro
Termux 提供了一個(gè)包proot-distro氯哮,它負(fù)責(zé)管理 Termux 內(nèi)的 Linux 發(fā)行版际跪。您可以通過(guò)執(zhí)行安裝此實(shí)用程序
pkg install proot-distro
目前它支持這些發(fā)行版:
- Alpine Linux (3.14.x)
- Arch Linux / Arch Linux 32 / Arch Linux ARM
- Debian (stable)
- Fedora 34
- Gentoo
- OpenSUSE (Tumbleweed)
- Ubuntu (20.04)
- Void Linux
要安裝發(fā)行版,只需運(yùn)行以下命令:
proot-distro install <alias>
其中“<alias>”為L(zhǎng)inux發(fā)行版本喉钢,例如“alpine”姆打。
安裝后,您可以通過(guò)執(zhí)行下一個(gè)命令來(lái)啟動(dòng) shell 會(huì)話(huà):
proot-distro login <alias>
以下是可用的 proot-distro 功能的基本概述:
-
proot-distro list
- 顯示支持的發(fā)行版及其狀態(tài). -
proot-distro install
- 安裝發(fā)行版. -
proot-distro login
- 啟動(dòng)發(fā)行版. -
proot-distro remove
- 卸載發(fā)行版. -
proot-distro reset
- 重新安裝發(fā)行版.
安裝Linux
proot-distro install ubuntu #安裝ubuntu
echo 'proot-distro login ubuntu' > .bashrc #自啟動(dòng)Ubuntu
Oh My Zsh
apt update
apt install git zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
vi ~/.oh-my-zsh/themes/my.zsh-theme 設(shè)置自用主題
local ret_status="%(?:%{$fg_bold[green]%}? :%{$fg_bold[red]%}? )"
PROMPT='${ret_status}$USER@%m %{$fg[cyan]%}%d %{$reset_color%}$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
.zshrc設(shè)置
#修改主題與插件
ZSH_THEME="my"
plugins=(git zsh-syntax-highlighting zsh-autosuggestions wd extract)
設(shè)置中文
apt install language-pack-zh-hans
echo 'LANG=zh_CN.UTF-8' > /etc/default/locale
其他
修改字體配色
長(zhǎng)按屏幕點(diǎn)擊More打開(kāi)設(shè)置---->Style---->安裝Termux:Styling
修改歡迎語(yǔ)
vi ../usr/etc/motd
修改DNS
echo 'nameserver 114.114.114.114' > ../usr/etc/resolv.conf