1、安装hugo

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

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启动脚本

/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

touch /lib/systemd/system/hugo.service
[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
[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
systemctl enable hugo
systemctl start hugo
systemctl restart hugo
systemctl status hugo

5、hugo学习