安装 Hugo
先安装 Hugo 的二进制文件,可以在官网上下载,也可以直接使用软件包管理器,考虑到apt更新极为缓慢,建议 Debian 系去官网下载deb包进行安装。
sudo apt install hugo # Debian 系
yay -S hugo # Arch 系
安装完成后,执行hugo version会看到类似如下的提示:
❯ hugo version
hugo v0.164.0-ce2470e7012b5ab5fc4e10ebe4027e9f8d9e00dc+extended linux/amd64 BuildDate=2026-07-06T16:39:30Z VendorInfo=gohugoio
即安装完成。
创建项目
我们使用hugo new site <项目名称>来创建项目,比如:
❯ hugo new site myBlog
Congratulations! Your new Hugo site was created in /home/kuqilin/myBlog.
Just a few more steps...
1. Change the current directory to /home/kuqilin/myBlog.
2. Create or install a theme:
- Create a new theme with the command "hugo new theme <THEMENAME>"
- Install a theme from https://themes.gohugo.io/
3. Edit hugo.toml, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content <SECTIONNAME>/<FILENAME>.<FORMAT>".
5. Start the embedded web server with the command "hugo server --buildDrafts".
See documentation at https://gohugo.io/.
可以看到成功的提示,接下来cd到项目文件夹myBlog,按照提示进行配置。
创建或安装主题
显然,我们是可以自己创建主题的,但是为了白嫖方便,直接前往https://themes.gohugo.io/下载一个称心的即可,这里选择了https://themes.gohugo.io/themes/hugo-theme-reimu/这个主题,进入Releases进行下载,得到zip文件,解压到myBlog/theme/文件夹下,顺便把hugo-theme-reimu-xxx的版本号删除一下。对于hugo-theme-reimu主题的安装方法,请自行查看文档。
