Halo简介
Halo是强大易用的开源建站工具,配合上丰富的模板与插件,帮助你构建你心中的理想站点。
官网 https://halo.run/
Halo的安装
拥有一台云服务器
新用户特惠购买腾讯云服务器 https://cloud.tencent.com/act/pro/lighthouse2021
腾讯云服务器新用户可试用一个月,阿里云新用户学生认证可免费试用7个月
使用 Docker Compose 安装Halo
https://docs.halo.run/getting-started/install/docker-compose/
安装Docker
https://docs.docker.com/engine/install/
centos安装Docker
https://docs.docker.com/engine/install/centos/
安装Docker compose
https://docs.docker.com/compose/install/
1.我使用的是Install Compose standalone
https://docs.docker.com/compose/install/standalone/
2.网速不好解决方法
curl -L http://mirror.azure.cn/docker-toolbox/linux/compose/v2.14.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
3.修改权限
chmod +x /usr/local/bin/docker-compose
4.查看版本
docker-compose.exe version
根据文档编写docker-compose.yaml
version: "3"
services:
halo:
image: halohub/halo:2.9
container_name: halo
restart: on-failure:3
depends_on:
halodb:
condition: service_healthy
networks:
halo_network:
volumes:
- ./:/root/.halo2
ports:
- "8090:8090"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
command:
- --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
- --spring.r2dbc.username=root
# MySQL 的密码,请保证与下方 MYSQL_ROOT_PASSWORD 的变量值一致。
- --spring.r2dbc.password=o#DwN&JSa56
- --spring.sql.init.platform=mysql
# 外部访问地址,请根据实际需要修改
- --halo.external-url=http://localhost:8090/
halodb:
image: mysql:8.0.31
container_name: halodb
restart: on-failure:3
networks:
halo_network:
command:
- --default-authentication-plugin=mysql_native_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_general_ci
- --explicit_defaults_for_timestamp=true
volumes:
- ./mysql:/var/lib/mysql
- ./mysqlBackup:/data/mysqlBackup
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
interval: 3s
retries: 5
start_period: 30s
environment:
# 请修改此密码,并对应修改上方 Halo 服务的 SPRING_R2DBC_PASSWORD 变量值
- MYSQL_ROOT_PASSWORD=o#DwN&JSa56
- MYSQL_DATABASE=halo
networks:
halo_network:
根据文档配置参数
启动 Halo 服务
docker-compose up -d