ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 下载二进制文件 * ubuntu16.04 * github: https://github.com/gohugoio/hugo/releases 下载文件后解压 ``` $ tar -zxvf hugo_0.79.1_Linux-64bit.tar.gz $ cd hugo_0.79.1_Linux-64bit $ export PATH='pwd':$PATH ``` 验证安装是否成功 ``` $ hugo version Hugo Static Site Generator v0.79.1-EDB9248D linux/amd64 BuildDate: 2020-12-19T15:42:17Z ``` ## 开始搭建博客 创建站点 ``` $ hugo new site ccblog $ cd ccblog ``` [hugo主题选择](https://themes.gohugo.io/hugo-theme-dream/) https://themes.gohugo.io/hugo-tranquilpeak-theme/ https://themes.gohugo.io/anatole/ 下载主题: ``` $ cd themes && git clone https://github.com.cnpmjs.org/g1eny0ung/hugo-theme-dream.git dream $ vim ../config.yaml theme = "dream" ``` 启动博客 ``` hugo server -t dream --buildDrafts ``` ## 写博客并上传 md格式语法大家稍微了解一下,在test下新建一篇博客firstblog ``` hugo new test/firstblog.md ``` ## 部署博客到Github 在github新建一个仓库,名字必须为你的github纯小写字母名字+github.io ### 使用cmd上传到github 首先生成public文件夹,下面命令你的`baseUrl`中改成自己的名字 ``` hugo --theme=dream --baseUrl="" --buildDrafts ``` 然后进public创建git仓库,上传github ``` cd public git init git add . git commit -m "部署Hugo博客第一次测试" //提交一次 git remote add origin https://github.com/zengxiaochao/zengxiaochao.github.io.git //关联远端github仓库 git push -u origin master //推上去 ```