Prerequisite
- Linux Server
- Public IP address (Optional)
- Docker & Docker compose
- Docker images mirror or proxy
- Git (Install Hugo themes need to use Git) (Optional)
Getting Started 🚀
- Create a Hugo root directory. E.g.: /opt/hugo
mkdir /opt/hugo
cd /opt/hugo
- Pull Hugo docker image. (Unofficial, but recommend.)
docker pull hugomods/hugo:debian-non-root-0.151.2
# or use docker images mirror. "docker.z5r.org" is myself mirror site. You also use other mirror site.
docker pull docker.z5r.org/hugomods/hugo:debian-non-root-0.151.2
- Initial Hugo project.
You can remove this docker container at later.
docker run -v ${PWD}:/src hugomods/hugo:debian-non-root-0.151.2 hugo new site your_proj_name
cd your_proj_name
- Install theme. (PaperMod theme)
cd /opt/hugo/your_proj_name/themes
git clone https://github.com/adityatelange/hugo-PaperMod PaperMod --depth=1
- Create YAML config file and the following to it.
This is my site config content. You need to change it.
cd /opt/hugo/your_proj_name
cat << EOF > config.yml
# baseURL must is your access address
baseURL: 'https://www.sgtu.ltd/'
languageCode: 'en-us'
title: '🧩 ZetoLog'
# Set theme, value is folder name under the themes directory.
theme: ["PaperMod"]
# Footer, support Markdown syntax
copyright: '©️ [ZetoHkr](/) · [辽ICP备2023006270号-1](http://beian.miit.gov.cn/)'
enableInlineShortcodes: true
enableRobotsTXT: true
buildDrafts: false
buildFuture: false
buildExpired: false
enableEmoji: true
pygmentsUseClasses: true
mainsections: ["posts", "papermod"]
outputs:
home:
- HTML
- RSS
- JSON
pagination:
disableAliases: false
pagerSize: 5
languages:
en:
languageName: "English"
weight: 1
taxonomies:
category: categories
tag: tags
series: series
menu:
main:
- name: Archive
url: archives
weight: 5
- name: Search
url: search/
weight: 10
- name: Tags
url: tags/
weight: 10
params:
env: production
author: ZetoHkr
defaultTheme: auto
ShowShareButtons: true
ShowReadingTime: true
displayFullLangName: true
ShowPostNavLinks: true
ShowBreadCrumbs: true
ShowCodeCopyButtons: true
ShowRssButtonInSectionTermList: true
ShowAllPagesInArchive: true
ShowPageNums: true
ShowToc: true
homeInfoParams:
Title: "🧩 ZetoLog"
Content: >
👋 Welcome to my blog site!
- Writing, coding, and living at my own pace.
- 写作、编程、以自己的节奏生活。
- A quiet corner of the web for ideas and growth.
- 在这片安静的网络角落,记录思想与成长。
socialIcons:
- name: github
title: Github
url: "https://github.com/shawngao-org"
- name: slack
title: Slack
url: "https://automq.slack.com/team/U08QER745MG"
- name: stackoverflow
title: Stack overflow
url: "https://stackoverflow.com/users/31673183/zetohkr"
- name: email
title: E-mail
url: "mailto:shawngao.org@outlook.com"
- name: x
title: X
url: "https://x.com/ZetoHkr"
- name: discord
title: Discord
url: "https://discord.com/users/981479120770859018"
- name: reddit
title: Reddit
url: "https://www.reddit.com/user/zeto_hkr/"
EOF
- Create
docker-compose.ymlfile and add the following to it.
This is my site config content. You need to change it.
cd /opt/hugo/your_proj_name
cat << EOF > docker-compose.yml
services:
hugo:
image: hugomods/hugo:debian-non-root-0.151.2
# --baseURL must is your access address.
command: server --config /src/config.yml --baseURL="https://www.sgtu.ltd/" --appendPort=false
restart: always
volumes:
- ./:/src
- ./hugo_cache:/tmp/hugo_cache
ports:
- 1313:1313
EOF
- Config
ArchiveandSearchmenus.
cat << EOF > /opt/hugo/your_proj_name/content/archives.md
---
title: "Archive"
layout: "archives"
url: "/archives/"
summary: archives
---
EOF
cat << EOF > /opt/hugo/your_proj_name/content/search.md
---
title: "Search" # in any language you want
layout: "search" # necessary for search
# url: "/archive"
# description: "Description for Search"
summary: "search"
placeholder: "placeholder text in search input box"
---
EOF
- Publish your first post.
mkdir /opt/hugo/your_proj_name/content/posts
cat << EOF > my-first-post.md
---
title: "My first Hugo post."
date: 2025-10-19
tags: ["hugo", "blog"]
categories: ["Other"]
draft: false
---
Welcome to my first Hugo post! 🎉
EOF
- Start your Hugo server.
cd /opt/hugo/your_proj_name
docker-compose up -d