The article is translated using AI.
Installation Steps:
- Install Debian inside proot
- Install Halo blog inside Debian
- Use CloudFlare for intranet penetration access
Installing the System:
First, install Termux and update packages
pkg update && pkg upgradeInstall proot container
pkg install proot proot-distroBy default,proot-distroselects a suitable distribution based on your device architecture. For example, if your device is ARM architecture, the distribution installed byproot-distrowill automatically adapt to ARM.
If you want to install and emulate a different architecture, you can refer to this article (usually to simulate using Docker; the container installed in this article cannot use Docker due to phone architecture limitations).
After installing proot, install a Linux system inside the container
You can choose a specific version or place the system files in the proot-distro directory for installation
proot-distro install debianAfter installation, enter the system
proot distro login debian
apt updateInstall Halo Blog
Since tools like 1Panel cannot be used (Docker is unavailable), the environment must be configured manually
Reference: https://docs.halo.run/category/安装指南/
First, install the necessary environment: JDK 21 and MariaDB database.
Install JDK
Obtain the JDK package and place it in a suitable location:
# mkdir java && cd java
wegt https://download.oracle.com/java/21/latest/jdk-21_linux-aarch64_bin.tar.gzExtract the JDK package:
tar -xzvf jdk包名Configure Java environment:
vim /etc/profileAdd the following content at the end of profile:
export JAVA_HOME=/usr/jdk21/jdk-21.0.4
export PATH=$JAVA_HOME/bin:$PATHType java to verify the installation
Install MariaDB
apt install mariadb-server
service mariadb startInstall Halo Blog
We do not recommend running Halo directly as the system root user. If you need to use the root user directly, skip this step.
Create a user named halo (the name can be arbitrary)
Create a new system user
useradd -m haloSet a password for the halo user
passwd haloLog in to the halo account
su - haloCreate a directory to store the runtime package, here using ~/app as an example
mkdir ~/app && cd ~/appDownload the runtime package
wget https://dl.halo.run/release/halo-2.20.0.jar -O halo.jarThe following are the official download addresses:
https://download.halo.run
https://github.com/halo-dev/halo/releases
Create the working directory
mkdir ~/.halo2 && cd ~/.halo2Create the Halo configuration file
vim application.yamlCopy the following content into application.yaml and configure it according to the instructions below.
server:
# Running port
port: 8090
spring:
# Database configuration, supports MySQL, MariaDB, PostgreSQL, H2 Database. Refer to the database configuration below for details.
r2dbc:
url: r2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSE
username: admin
password: 123456
sql:
init:
mode: always
# Must be adjusted according to the r2dbc configuration
platform: h2
halo:
caches:
page:
# Whether to disable page caching
disabled: true
# Working directory location
work-dir: ${user.home}/.halo2
# External access URL
external-url: http://localhost:8090
# Attachment mapping configuration, typically used for migration scenarios
attachment:
resource-mappings:
- pathPattern: /upload/**
locations:
- migrate-from-1.xDatabase Configuration Instructions:
| Parameter Name | Description |
| spring.r2dbc.url | Database connection address. See the Configuration Correspondence below for details. |
| spring.r2dbc.username | Database username |
| spring.r2dbc.password | Database password |
| spring.sql.init.platform | Database platform name, supports postgresql, mysql, mariadb, h2 |
Configuration Correspondence:
| Connection Method | Connection URL Format | spring.sql.init.platform |
| PostgreSQL | r2dbc:pool:postgresql://{HOST}:{PORT}/{DATABASE} | postgresql |
| MySQL | r2dbc:pool:mysql://{HOST}:{PORT}/{DATABASE} | mysql |
| MariaDB | r2dbc:pool:mariadb://{HOST}:{PORT}/{DATABASE} | mariadb |
| H2 Database | r2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSE | h2 |
HOST: Database service address, e.g., localhost
PORT: Database service port, e.g., 3306
DATABASE: Database name, e.g., halo, must be created in advance. Taking MySQL as an example:
create database halo character set utf8mb4 collate utf8mb4_bin;
It is not recommended to use the default H2 database in production, as improper operation may cause data file corruption. If it must be used due to certain reasons (e.g., insufficient memory to run a standalone database), it is advisable to back up data regularly.
To keep the deployment process concise, this document only provides necessary configuration examples. For a complete list of configuration options, refer to: Configuration Guide
After configuration, save the file.
Test Run Halo
cd ~/app && java -Dfile.encoding=UTF-8 -jar halo.jar --spring.config.additional-location=optional:file:$HOME/.halo2/If no abnormal logs are observed, you can try to access Halo
Open http://ip:port to be redirected to the initialization page.
For information on how to set up Halo as a system service and how to update the system, refer to theofficial documentation above.
Configure Intranet Penetration
If you need to configure domain access, it is recommended to set up reverse proxy and domain resolution before initialization. However, here we use CloudFlare's free intranet penetration service.
Reference: https://www.bilibili.com/video/BV1H4421X7Wg
Visit and register: https://www.cloudflare.com/zh-cn/
First, migrate the domain to CloudFlare for resolution. Here, we use a Tencent Cloud domain as an example.
On the CloudFlare website, click 'Add Domain' in the upper right corner, enter your DNS, select the free service, click Continue, and then find the name servers below.
Similar to
NS xxxx.ns.cloudflare.com
NS xxxx.ns.cloudflare.com
Then, in the Tencent Cloud console -> My Domains -> More -> Modify DNS Server -> Custom DNS, change to the two entries above.
After modification, return to CloudFlare and wait for the changes to take effect. The domain can then be used on CloudFlare.
In the CloudFlare left sidebar, go to Zero Trust, fill in some required information, then open Networks -> Tunnels, add a tunnel. CloudFlare will provide tunnel installation instructions based on your operating environment. Once the tunnel is activated, you can try accessing your blog using the domain!