termux安装及配置 安装好termux之后,需要装一些软件来进行相应的环境配置.
1 2 3 4 5 pkg install openssh sshd ssh localhost -p 8022
参考
会一同装好npm
需要已经安装好wget
1 2 3 4 sh -c "$(curl -fsSL https://github.com/Cabbagec/termux-ohmyzsh/raw/master/install.sh) " ~/termux-ohmyzsh/install.sh
出现下边两个选项是来选背景色和字体
1 2 Enter a number, leave blank to not to change: 14 Enter a number, leave blank to not to change: 6
该脚本会自动将外置存储挂载,在~/storage/下 修改主题可以使用如下方式
1 2 3 vim .zshrc ZSH_THEME="jaischeema"
参考
1 2 3 4 5 npm install -g wcode wcode -p 9999 /home ip:9999
参考_1 参考_2 参考_3
termux安装内网穿透工具cploar 1 2 3 4 5 6 apt install dnsutils curl -O -L https://www.cpolar.com/static/downloads/cpolar-stable-linux-arm.zip unzip cpolar-stable-linux-arm.zip
解压好之后,去官网 注册帐号,获取token 登录后台仪表盘 ,验证,复制token值
1 2 3 4 5 6 ./cpolar authtoken xxxxxxxxxxtokenxxxxxxx ./cpolar http 8080 ./cpolar tcp 22
映射完后等一会会有链接出现在线文档 ,参考
termux避免长时间熄屏自动断开ssh
termux加载启动脚本 1 2 3 4 vim .zshrc ./study_init.sh
code-server安装 termux安装code-server 1 2 3 4 5 6 7 8 9 10 11 pkg update -y pkg install -y python nodejs yarn yarn global add code-server cd ~/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/vim binding.gyp
1 2 3 4 5 6 7 "targets" : [ { "target_name" : "spdlog" , "libraries" : [ "-latomic" ] , "sources" : [ "src/main.cc" , "src/logger.cc" ] ,
1 2 3 4 5 6 7 8 9 10 11 12 13 npm install npm test cd ~code-server --auth none --disable-telemetry export PASSWORD=123456 nohup code-server --auth password --bind-addr 0.0.0.0:8080 &cat ~/.config/code-server/config.yaml
参考
code-server官方安装教程 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 apt update && apt upgrade apt install build-essential python git nodejs yarn yarn global add code-server code-server yarn global upgrade code-server --latest export PASSWORD=123456 nohup code-server --auth password --bind-addr 0.0.0.0:8080 &cat ~/.config/code-server/config.yaml
参考
termux挂载的debian中安装code-server 这个方法适用于在termux中安装code-server怎么都安装不好的情况(如果速度过慢可以使用小飞机加速) 使用之前可以参考termux安装debian 先行安装好系统
1 2 3 4 5 6 7 8 9 10 11 cd ~wget https://github.com/cdr/code-server/releases/download/v3.10.2/code-server_3.10.2_arm64.deb dpkg -i code-server_3.10.2_arm64.deb export PASSWORD=123456 nohup code-server --auth password --bind-addr 0.0.0.0:8080 &cat ~/.config/code-server/config.yaml
termux安装debian
下载AnLinux , 装好后
点击选择, 选择一个linux发行版, 这里选择debian
点击复制, 然后点击启动, 将命令粘贴到termux命令行运行.中间过程可能较慢, 建议使用小飞机进行加速
安装好后使用./start-debian.sh来运行新安装的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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 vi ./start-debian.sh command +=" -b /sdcard:/root/sdcard" vapt update apt upgrade apt install gcc apt install g++ apt install gfortran apt install cmake apt install default-jdk apt install python3 apt install python3-pip pkg install postgresql mkdir -p ~/software/data/pgdatainitdb ~/software/data/pgdata vi ~/software/data/pgdata/pg_hba.conf 0.0.0.0/0 cd ~postgres -D ~/software/data/pgdata -h 0.0.0.0 whoami ``` [参考1](https://zhuanlan.zhihu.com/p/95865982) [参考2](https://www.bilibili.com/video/av842947375/) [参考3](https://blog.csdn.net/baidu_18607183/article/details/54093251) 可以将脚本保存成`xx.sh`, 然后赋予执行权限并将脚本路径添加到`.zshrc`文件后 需要安装`zsh`, 可以参考`安装终端配色` ```bash sshd_count=`ps -ef | grep sshd | grep -v grep | wc -l` if [ $sshd_count -eq 0 ]then sshd nohup postgres -D software/data/pgdata -h 0.0.0.0 & ./start-debian.sh fi termux-wake-lock
安卓5安装termux 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 vi $PREFIX /etc/apt/sources.list.d/game.list deb https://termux.com/game-packages-21-bin games stable vi $PREFIX /etc/apt/sources.list.d/science.list deb https://termux.com/science-packages-21-bin science stable pkg update pkg upgrade pkg install openssh passwd ssh 手机ip -p 8022
参考1 参考2
使用默认的apache运行php程序 因为使用php自带的http服务运行php程序太慢了,所以使用自带的apache来运行php程序
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 pkg install php7 php7-apache php -v cp ~/../usr/etc/apache2/httpd.conf ~/../usr/etc/apache2/httpd.conf.bakvim ~/../usr/etc/apache2/httpd.conf <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> AddType application/x-httpd-php .php LoadModule php7_module libexec/apache2/libphp7.so apachectl -t apachectl -M LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so
apache添加php支持 Apache is running a threaded MPM