# 1、安装hugo ```bash wget https://github.com/gohugoio/hugo/releases/download/v0.59.1/hugo_0.59.1_Linux-64bit.tar.gz tar -xvf hugo_0.59.1_Linux-64bit.tar.gz cp hugo /usr/local/bin/ ``` # 2、启动hugo server ```bash hugo new site quickstart cd quickstart git init git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke; echo 'theme = "ananke"' >> config.toml hugo new posts/my-first-post.md hugo server -D ``` # 3、hugo server启动脚本 ```bash /usr/local/bin/god --nohup --pidfile /var/run/hugo.pid -- /usr/local/bin/hugo server --source /data/tmp/quickstart --baseURL https://blog.ziki.cn --appendPort=false --disableLiveReload --log --logFile /var/log/hugo.log -DEF --port1313 --bind 0.0.0.0 ``` # 4、systemd ```bash touch /lib/systemd/system/hugo.service ``` ```toml [Unit] Description=Hugo server After=syslog.target network.target [Service] Type=forking PIDFile=/var/run/hugo.pid ExecStart=/usr/local/bin/god --nohup --pidfile /var/run/hugo.pid -- /usr/local/bin/hugo server --source /data/quickstart --baseURL https://blog.ziki.cn --appendPort=false --disableLiveReload --log --logFile /var/log/hugo.log -DEF --port 1313 --bind 0.0.0.0 ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target ``` ```toml [Unit] Description=Hugo server After=syslog.target network.target [Service] Type=simple ExecStart=/usr/local/bin/hugo server --minify --source /data/quickstart --baseURL https://blog.ziki.cn --appendPort=false --disableLiveReload=false --liveReloadPort=443 -DEF --port 1313 --bind 0.0.0.0 ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target ``` ```bash systemctl enable hugo systemctl start hugo systemctl restart hugo systemctl status hugo ``` # 5、hugo学习 * [releases](https://github.com/gohugoio/hugo/releases) * [Hugo 从入门到会用](https://blog.olowolo.com/post/hugo-quick-start/ "Hugo 从入门到会用") * [使用Hugo搭建静态站点](https://tonybai.com/2015/09/23/intro-of-gohugo/ "使用Hugo搭建静态站点") * [在Vim中用Markdown写Hugo](http://note.qidong.name/2017/07/01/vim-markdown-for-hugo/ "在Vim中用Markdown写Hugo") * [How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-hugo-site-to-production-with-git-hooks-on-ubuntu-14-04 "How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04") * [使用 Git Hook自动部署Hexo到个人VPS](http://www.swiftyper.com/2016/04/17/deploy-hexo-with-git-hook/)