termux相关命令

pkg install vim

apt update
apt install proot-distro
proot-distro install debian
proot-distro login debian

df -h 查看磁盘空间

安装linux
pkg install proot
termux-chroot
pkg install wget
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
ls
./start-centos.sh
exit退出

termux中执行:termux-setup-storage,就可以进入外部存储了

cd ~/storage 进入内部存储卡
cd /storage 进入外部存储卡

CentOS 同目录的storage 中的3233-3434目录就是外部存储卡
进入外部存储卡的方式:
全目录地址为:/storage/3233-3434/Android/data/com.termux/files
也是目录地址:/data/data/com.termux/files/home/storage/external-1
也是目录地址:~/storage/external-1
ln -s ~/storage/external-1 CentOS/centos-fs/usr/local/external-1

CentOS/centos-fs/usr/local

apt install openssh
sshd

passwd

whoami
ifconfig

ssh连接时候需要连接同一个,都可以上网的wifi
echo “sshd” >> ~/.bashrc

或者:

if pgrep -x "sshd" >/dev/null
  then
    echo "sshd运行中..."
  else
    sshd
    echo "自动启动sshd"
fi

pkg install nginx
nginx
nginx -s reload
nginx -s stop
nginx -s quit
kill -9 pgrep nginx
nginx配置,参考:
vim $PREFIX/etc/nginx/nginx.conf
https://www.sqlsec.com/2018/05/termux.html?tdsourcetag=s_pctim_aiomsg
cp -r /data/data/com.termux/files/usr/share/nginx/html /storage/3233-3434/Android/data/com.termux/files/html

安装jdk
yum install java-1.8.0-openjdk* -y
java -version

tomcat
https://tomcat.apache.org/download-80.cgi
/data/data/com.termux/files/home/CentOS/centos-fs/usr
/usr/local/tomcat8
直接将本地tomcat考到termux中,然后解压
yum install unzip
unzip tomcat

或者tar zxvf apache-tomcat-8.0.53.tar.gz

启动tomcat时如果无法启动提示权限不足,需要执行命令:
chmod u+x *.sh
ls -l 文件名,查看文件权限

/data/data/com.termux/files/home/CentOS/centos-fs/usr/lib

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el8_4.aarch64/

修改环境变量
配置vim ~/.zshrc,增加如下内容:

JDK8

export JAVA_HOME=/data/data/com.termux/files/home/java/jdk8
export PATH=$PATH:$JAVA_HOME/bin:.
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.

java 安装目录 /data/data/com.termux/files/home/CentOS/centos-fs/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el8_4.aarch64/
tomcat 安装目录 /data/data/com.termux/files/home/CentOS/centos-fs/usr/local/apache-tomcat-8.0.26/bin/startup.sh

安装postgresql
pkg install postgresql
PGDATA=/data/data/com.termux/files/var/lib/pgsql/data
export PGDATA
initdb –encoding=utf-8

修改postgresql.conf,pg_hba.conf允许Navicat连接
pg_ctl start
pg_ctl restart重启数据库
createuser postgres
createdb mydb
psql mydb

termux中的linux 访问termux文件
https://blog.csdn.net/qq_35425070/article/details/86041193

创建文件软连接
ln -s /data/data/com.termux/files/home/storage/shared/tencent/QQfile_recv QQ
~ $ cd
~ $ ls

访问win10共享文件
apt install samba*
使用时提示smb.conf文件,需要手动创建
smbclient -L //192.168.1.108/share -U 账号%密码
smbclient //192.168.1.108/Downloads -U 账号%密码 -W domain

apache
./apachectl start
apachectl stop

php -S 0.0.0.0:8080 -t www/

安装php

pkg install php

pkg install php-fpm

编辑修改php-fpm配置: 

vim $PREFIX/etc/php-fpm.d/www.conf   

 listen = 127.0.0.1:9000

启动php-fpm
php-fpm

关闭php
killall php-fpm
ps aux|grep php-fpm

kill -USR2 42891

查看端口情况
netstat -lntp
查看端口占用情况
netstat -tunlp | grep 端口
关闭进程
kill -9 pid

启动centos
cd CentOS
./start-centos.sh

启动tomcat
cd ../usr/local/apache-tomcat-8.0.26/bin/
./startup.sh

启动wordpress
php -S 0.0.0.0:18081 -t ./www

启动mysql
cd ‘/data/data/com.termux/files/usr’ ; /data/data/com.termux/files/usr/bin/mysqld_safe –datadir=’/data/data/com.termux/files/usr/var/lib/mysql’

Usage: mysqld {start|stop|restart|reload|force-reload|status|configtest|bootstrap}
cd /etc/init.d/
[root@localhost init.d]# ./mysqld start
/usr/local/mariadb/database

安装mariadb
pkg install mariadb
mysql_install_db
You can start the MariaDB daemon with:
cd ‘/data/data/com.termux/files/usr’ ; /data/data/com.termux/files/usr/bin/mysqld_safe –datadir=’/data/data/com.termux/files/usr/var/lib/mysql’

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注