使用Docker搭建Halo博客程序

目录

1.安装JAVA:

2.安装mysql:

3.安装halo:


1.安装JAVA:

sudo yum install java-11-openjdk -y
java -version

2.安装mysql:

docker run -id \
-p 3307:3306 \
--name=b_mysql \
-v $PWD/conf:/etc/mysql/mysql.conf.d \       
-v $PWD/logs:/var/logs \
-v $PWD/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=$Rui123456 \
mysql:8.0.32

3.安装halo:

  • 下载application.yaml模板:

    mkdir ~/.halo && cd ~/.halo
    wget https://dl.halo.run/config/application-template.yaml -O ./application.yaml
  • 修改application.yaml配置文件:

    server:
      port: 8090
    ​
      # Response data gzip.
      compression:
        enabled: false
    spring:
      datasource:
    ​
        # H2 database configuration.
        # driver-class-name: org.h2.Driver
        #url: jdbc:h2:file:~/.halo/db/halo
        #username: admin
        #password: 123456
    ​
        # MySQL database configuration.
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://8.130.17.95:3307/halodb?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
        username: root
        password: '@Qv110119'
    ​
      # H2 database console configuration.
      #h2:
      #  console:
      #    settings:
      #      web-allow-others: false
      #    path: /h2-console
      #    enabled: false
    ​
    halo:
    ​
      # Your admin client path is https://your-domain/{admin-path}
      admin-path: admin
    ​
      # memory or level
      cache: memory
  • 创建halo容器:

    docker run -it -d --name halo -p 8090:8090 -v ~/.halo:/root/.halo --restart=unless-stopped halohub/halo:1.6.0

你可能感兴趣的:(docker,docker,java,mysql)