termux部署ubuntu、blog

安装基础组件

# pkg install wget
# pkg install vim
# pkg install curl
# pkg install proot

编辑快捷键

# mkdir ~/.termux
# touch ~/.termux/termux.properties
# vim ~/.termux/termux.properties
[增加配置] 
extra-keys = [['TAB','ESC','CTRL','HOME','END','UP',';'],['/','|','-','~','LEFT','DOWN','RIGHT']]

拉取ubuntu镜像

【安装Ubuntu】
# wget https://raw.githubusercontent.com/Neo-Oli/termux-ubuntu/master/ubuntu.sh
# bash ubuntu.sh

【安装mysql、openjdk】
# apt update
# apt install -y wget
# apt install -y unzip
# apt install -y net-tools
# apt install -y vim
# apt install -y openjdk-8-jdk
# apt-get install mysql-server
# apt-get isntall mysql-client
# apt-get install libmysqlclient-dev
# service mysql restart

【修改密码】
mysql> alter user 'root'@'localhost' identified by 'root'; 
mysql> alter user 'root'@'%' identified by 'root'; 
mysql> alter user 'root'@'127.0.0.1' identified by 'root'; 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;
mysql> flush privileges;
mysql> create database halodb;

【安装maven】
# apt install maven

部署halo

【halo地址】
https://github.com/halo-dev/halo.git

【拉取git】
# git clone https://github.com/halo-dev/halo.git
# cd halo-master
# vim src/main/resources
[修改配置]
    # H2database 配置
#    driver-class-name: org.h2.Driver
#    url: jdbc:h2:file:~/halo/halo
#    username: admin
#    password: 123456

    #MySql配置
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/halodb?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
    username: root
    password: root

【编译启动】
# mvn clean package -Pprod
# java -jar target/halo.jar

【前端】
http://localhost:8090

【后端】
http://localhost:8090/admin [admin / 123456]

部署sym

【tomcat】
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.39/bin/apache-tomcat-8.5.39.zip
# unzip apache-tomcat-8.5.39.zip ; mv apache-tomcat-8.5.39 sym
【sym】
# wget https://github.com/b3log/symphony/releases/download/v3.4.8/symphony-v3.4.8.war
# mv symphony-v3.4.8.war sym.war
# mv sym.war sym/webapps

【脚本】
alias run="cd /root/sym/bin;bash run.sh"

#!/bin/bash
LPATH=$(cd `dirname $0`;pwd)
echo ">>Current PATH : ${LPATH}<<"
#【变更PORT】
CurrPORT=8080
if [ "${CurrPORT}" != "$(grep -w serverPort ${LPATH%/*}/weapps/sym/WEB-INF/classes/latke.properties|awk -F '=' '{print $NF}')" ];then
	echo ">>Change CurrPORT : ${CurrPORT}<<"
	sed -i "s/serverPort=.*/serverPort=${CurrPORT}/g" ${LPATH%/*}/weapps/sym/WEB-INF/classes/latke.properties
else
	echo ">>CurrPORT : ${CurrPORT} , Don't Need Change<<"
fi
#【变更IP】
CurrIP=$(ifconfig|grep -w "inet 地址"|grep -v "127.0.0.1"|awk -F ' ' '{print $2}'|awk -F ':' '{print $NF}')
if [ "${CurrIP}" = "" ];then
	echo ">>CurrIP Is Null !<<"
	exit
else
	echo ">>Change CurrIP : ${CurrIP}<<"
	sed -i "s/serverHost=.*/serverHost=${CurrIP}/g" ${LPATH%/*}/weapps/sym/WEB-INF/classes/latke.properties
fi
#【停止tomcat】
echo ">>Shutdown Tomcat !<<"
${LPATH}/shutdown.sh
#【启动数据库】
echo ">>Start Mysql !<<"
service mysql restart
#【清理日志】
echo ">>Clear Logs !<<"
rm -rf ${LPATH}/logs/*
#【启动tomcat】
echo ">>Startup Tomcat !<<"
${LPATH}/startup.sh
#【打印日志】
echo ">>logging !<<"
sleep 3
tail -f ${LPATH%/*}/logs/catalina.out

【前端】
http://localhost:8080/sym    [war包解压路径名]

cpolar

官网地址:https://dashboard.cpolar.com/get-started
选择版本:Linux (ARM) 
~~~bash
$ unzip cpolar.zip
$ ./cpolar authtoken OTA2N2ZmNWMtZTFmYy00ZjBiLWFjMzctMmVjY2Y5NDUzMmRk
$ ./cpolar http 8080  #在端口80上启动HTTP隧道
帮助:
$ ./cpolar help 

猜你喜欢

转载自blog.csdn.net/waplys/article/details/89237189