rkey

rkey

Install Halo Blog using Docker

Installing Halo Blog with Docker#

  1. Create a container
docker run \
  -it -d \
  --name halo \
  -p 8090:8090 \
  -v ~/.halo2:/root/.halo2 \
  halohub/halo:2.3.0 \
  --halo.external-url=http://localhost:8090/ \
  --halo.security.initializer.superadminusername=admin \
  --halo.security.initializer.superadminpassword=P@88w0rd

Note: This command uses the built-in H2 Database by default. To use PostgreSQL, please refer to: Deploying with Docker Compose

  • -it: Enable input and connect to a pseudo terminal
  • -d: Run the container in the background
  • --name: Specify a name for the container
  • -p: Port mapping, in the format of host port:container port, can be configured in application.yaml.
  • -v: Working directory mapping. The format is: -v host path:/root/.halo2, the latter cannot be modified.

Additionally: Before using the command above, you need to change the http://localhost:8090/ on line 7 to your machine's IP address. If you want to change the password, it is recommended to change the password directly as well; regarding the admin username, change it if you want, or leave it as is.

Variable Explanation:

Parameter NameDescription
spring.r2dbc.urlDatabase connection address, details can be found in the Database Configuration below
spring.r2dbc.usernameDatabase username
spring.r2dbc.passwordDatabase password
spring.sql.init.platformDatabase platform name, supports postgresql, mysql, h2, needs to correspond with SPRING_R2DBC_URL
halo.external-urlExternal access link, if public access is needed, it should be configured to the actual access address
halo.security.initializer.superadminusernameInitial super admin username
halo.security.initializer.superadminpasswordInitial super admin password

Database Configuration:

Connection MethodConnection Address FormatSPRING_SQL_INIT_PLATFORM
PostgreSQLr2dbc:pool:postgresql://{HOST}:{PORT}/{DATABASE}postgresql
MySQLr2dbc:pool:mysql://{HOST}:{PORT}/{DATABASE}mysql
H2 Databaser2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSEh2
  1. Access $HALO_EXTERNAL_URL/console/ (external access link) in your browser to enter the Halo admin panel. The admin username is admin, and the login password is the HALO_SECURITY_INITIALIZER_SUPERADMINPASSWORD set above.

If you need to configure domain access, it is recommended to set up reverse proxy and domain resolution before initialization. If you cannot access via http://ip:port, please add the running port to the security group in the server vendor's backend. If the server uses a Linux panel, please check if there are security group configurations in this Linux panel, and also add the port to the security group.

Upgrade Version#

  1. Pull the new version image

    docker pull halohub/halo:2.3.0
    
  2. Stop the running container

    docker stop halo
    docker rm halo
    
  3. Backup data (important)

    cp -r ~/.halo2 ~/halo2.archive
    

    Note that the halo2.archive filename does not have to be named according to this document; it is just an example.

  4. Update Halo

    After modifying the version number, recreate the container as initially installed.

    docker run \
      -it -d \
      --name halo \
      -p 8090:8090 \
      -v ~/.halo2:/root/.halo2 \
      halohub/halo:2.3.0 \
      --halo.external-url=http://localhost:8090/ \
      --halo.security.initializer.superadminusername=admin \
      --halo.security.initializer.superadminpassword=P@88w0rd  
    
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.