执行一次 termux-setup-storage
命令,以便弹出“读写手机储存”授权对话框进行授权
(也可以手动在系统设置中进行操作)
termux-change-repo
pkg update
pkg upgrade
参考:清华大学开源软件镜像站
pkg update
pkg install tsu vim git -y
pkg update
pkg upgrade
pkg install openssh termux-auth -y
whoami
passwd #设置密码(123)
ifconfig #查看ip
sshd -p 9000 #设置ssh端口为9000(此处我的每次打开需要设置)
vi .bashrc #解决上面的问题
i
sshd -p 9000
:wq
ssh [email protected] -p 9000
参考:进击的mark
pkg install proot-distro #安装proot-districto
proot-distro list #查看可安装的系统
proot-distro install ubuntu #安装Ubuntu
proot-distro login ubuntu #登录Ubuntu
cat /etc/issue #查看版本信息
exit
vi .bashrc #设置自启动
i
proot-distro login ubuntu
:wq
参考:清华大学开源软件镜像站
apt-get update && apt-get upgrade
参考:标题三
apt-get update & apt-get upgrade
apt-get install tree wget vim tar lrzsz git -y
wget https://download.oracle.com/java/17/latest/jdk-17_linux-aarch64_bin.tar.gz
tar -xvzf jdk-17_linux-aarch64_bin.tar.gz #解压缩文件,并在终端上显示详细信息
mkdir -p /usr/local/java & mv jdk-17.0.7 /usr/local/java #新建目录,移动jjdk路径
vim /etc/profile #配置环境变量
#i
## JDK环境变量
#export PATH=/usr/local/java/jdk-17.0.7/bin:$PATH
#Esc
#:wq
source /etc/profile #更新环境变量
java -version #检查安装是否成功
x
:表示解压缩模式,即从归档文件中提取文件或目录;v
:表示详细模式,即在终端上显示提取的文件或目录的详细信息;z
:表示 gzip 压缩,即将 tar 文件当成 gzip 文件处理;f
:表示归档文件,即指示 tar 命令使用给定的文件作为归档文件。apt search tomcat #库中有tomcat9
apt-get install tomcat9 -y
cd /usr/share/tomcat9/bin
./starup.sh #或sh starup.sh
#此处错误表明无法创建catalina.out日志,因为/usr/share/tomcat9/logs目录不存在
mkdir -p /usr/share/tomcat9/logs #创建缺少的目录
chmod 777 /usr/share/tomcat9/logs #授予目录权限
./starup.sh #或sh starup.sh
#成功
/* 出现的错误
Using CATALINA_BASE: /usr/share/tomcat9
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /usr/share/tomcat9/temp
Using JRE_HOME: /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/usr/local/java/jdk-17.0.7//jre
Using CLASSPATH: /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
Using CATALINA_OPTS:
touch: cannot touch '/usr/share/tomcat9/logs/catalina.out': No such file or directory
./catalina.sh: 504: cannot create /usr/share/tomcat9/logs/catalina.out: Directory nonexistent
*/
/* 成功输出
Using CATALINA_BASE: /usr/share/tomcat9
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /usr/share/tomcat9/temp
Using JRE_HOME: /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/usr/local/java/jdk-17.0.7//jre
Using CLASSPATH: /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
*/
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.74/bin/apache-tomcat-9.0.74.tar.gz
tar -xvzf apache-tomcat-9.0.74.tar.gz -C /usr/local
/usr/local/apache-tomcat-9.0.74/bin/startup.sh
#或sh /usr/local/apache-tomcat-9.0.74/bin/starup.sh(启动脚本文件)
more /usr/share/tomcat9/logs/catalina.out
#或
tail -50 /usr/share/tomcat9/logs/catalina.out
ps -ef | grep tomcat
cd /usr/local/apache-tomcat-9.0.74/bin
./shutdown.sh #或sh shutdown.sh(停止脚本文件)
ps -ef | grep tomcat
kil -9 xxx
#确保在Ubuntu中
#安装并启动mysql服务
apt install mysql-server -y
service mysql status
service mysql start
mysql
#开机自启
vim .bashrc
i
service mysql start
:wq
#开启远程和修改密码
use mysql
select host,user from user;
update user set host='%' where user='root';
select host,user from user;
alter user 'root'@'%' identified with mysql_native_password by '123456';
exit
#测试登录
mysql -u root -p
123456
use mysql;
flush privileges;
exit
#在本地测试连接
vim /etc/mysql/mysql.conf.d/mysqld.cnf #修改为0.0.0.0
exit
proot-distro login ubuntu
service mysql status
service mysql start
telnet 192.168.40.116 3306
#navicat测试连接
-- 查看服务是否运行
service mysql status
-- 启动服务
service mysql start
-- 关闭服务
service mysql stop
-- 重启服务
service mysql restart
使用 apt-get 命令卸载 MySQL:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
删除 MySQL 的配置文件和数据:
sudo rm -rf /etc/mysql/ /var/lib/mysql/
清除 MySQL 相关的依赖:
sudo apt-get autoremove
清除残留文件和目录:
sudo find / -iname 'mysql*' -exec rm -rf {} ;
参考: unbuntu如何彻底删除mysql?
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.tar.gz
#以上地址在清华大学镜像站搜索apache找到
tar -zxvf apache-maven-3.9.1-bin.tar.gz -C /usr/local
vi /etc/profile.d/maven.sh
i
export MAVEN_HOME=/usr/share/maven
export PATH=$PATH:$MAVEN_HOME/bin
:wq
source /etc/profile.d/maven.sh
mvn -version
mkdir /usr/local/repo
vi /usr/local/apache-maven-3.9.1/conf/settings.xml
#修改如下图
apt install maven -y
mvn -version
#指定本地仓库
mkdir /usr/local/repo
vi /usr/share/maven/conf/settings.xml
#修改如上图
cd /usr/local/
git clone https://gitee.com/hs130539/helloworld.git
#!/bin/sh
echo =================================
echo '自动化部署脚本启动'
echo =================================
echo '停止原来运行中的工程'
APP_NAME=helloworld
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 2
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi
echo '准备从Git仓库拉取最新代码'
cd /usr/local/helloworld
echo '开始从Git仓库拉取最新代码'
git pull
echo '代码拉取完成'
echo '开始打包'
mvn clean package -Dmaven.test.skip=true
cd target
echo '启动项目'
nohup java -jar helloworld-1.0-SNAPSHOT.jar &
echo '项目启动完成'
chmod 777 bootStart.sh
./bootStart.sh
cd /usr/local/helloworld/target && cat nohub.out
(显示hello world…)#apt-get purge maven
#apt-get autoremove
rm -rf /usr/local/apache-maven-3.9.1
rm -rf /etc/profile.d/maven.sh
rm -rf /usr/local/repo
mvn -version
#重启
apt update
apt install redis-server
service redis-server status
service redis-server start
redis-cli #登录测试
keys * #测试
vim /etc/redis/redis.conf
/requirepass #搜索
i
requirepass 123456
:wq
service redis restart
redis-cli #登录测试
keys * #测试(会报错)
auth 123456 #认证
redis-cli -h localhost -p 6379 -a 123456 #另一种方式
keys * #测试
vim /etc/redis/redis.conf
/bind #搜索
i
#bind 127.0.0.1 ::1 #将这一行注释
:wq
service redis restart
cd D:\Redis-x64-5.0.14.1 #Windos PowerShell
./redis-cli.exe -h 192.168.103.116 -p 6379 -a 123456 #Windos PowerShell
apt update
apt install nginx
service nginx status
service nginx start
vim /etc/nginx/sites-enabled/default
(改为8090)nginx -v
nginx -t
(t:测试(text))nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx
nginx -s stop
nginx -s reload
/var/www/html/dist
vim /etc/nginx/sites-enabled/default
(将root后地址改为/var/www/html/dist)vim /etc/nginx/sites-enabled/default
(location里新加proxy_pass http://192.168.1.85:8080;
)nginx -s reload
(重新加载配置文件)