Installing Halo Blog with Termux

2026-05-20 · 14 min read

This article details the complete process of installing the Halo blog on an Android device via Termux, including deploying a Debian system using a proot container, manually configuring JDK 21 and MariaDB database, installing and running Halo version 2.20.0, and using CloudFlare for intranet penetration access. The steps are clear and suitable for mobile blog deployment without a Docker environment.

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 upgrade

Install proot container

pkg install proot proot-distro
By default, proot-distro selects a suitable distribution based on your device architecture. For example, if your device is ARM architecture, the distribution installed by proot-distro will 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 debian

After installation, enter the system

proot distro login debian
apt update

Install 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.gz

Extract the JDK package:

tar -xzvf jdk包名

Configure Java environment:

vim /etc/profile

Add the following content at the end of profile:

export JAVA_HOME=/usr/jdk21/jdk-21.0.4

export PATH=$JAVA_HOME/bin:$PATH

Type java to verify the installation

Install MariaDB

apt install mariadb-server
service mariadb start

Install 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 halo

Set a password for the halo user

passwd halo

Log in to the halo account

su - halo

Create a directory to store the runtime package, here using ~/app as an example

mkdir ~/app && cd ~/app

Download the runtime package

wget https://dl.halo.run/release/halo-2.20.0.jar -O halo.jar
The following are the official download addresses:

https://download.halo.run

https://github.com/halo-dev/halo/releases

Create the working directory

mkdir ~/.halo2 && cd ~/.halo2

Create the Halo configuration file

vim application.yaml

Copy 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.x

Database Configuration Instructions:

Parameter NameDescription
spring.r2dbc.urlDatabase connection address. See the Configuration Correspondence below for details.
spring.r2dbc.usernameDatabase username
spring.r2dbc.passwordDatabase password
spring.sql.init.platformDatabase platform name, supports postgresql, mysql, mariadb, h2

Configuration Correspondence:

Connection MethodConnection URL Formatspring.sql.init.platform
PostgreSQLr2dbc:pool:postgresql://{HOST}:{PORT}/{DATABASE}postgresql
MySQLr2dbc:pool:mysql://{HOST}:{PORT}/{DATABASE}mysql
MariaDBr2dbc:pool:mariadb://{HOST}:{PORT}/{DATABASE}mariadb
H2 Databaser2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSEh2
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!