July 15, 2020

Ubuntu 18.04/20.04安装/更新Hugo最新版

初版:2019-10-15

为方便使用,不要使用snap或git方式安装。 因为snap为了安全,对/var/www/只有只读权限

hugo new site ~/home/domain.com/ -v

Ubuntu 18.04/20.04安装/更新Hugo最新版(0.74.2 Extended):

cd /tmp
wget https://github.com/gohugoio/hugo/releases/download/v0.74.2/hugo_extended_0.74.2_Linux-64bit.deb
dpkg -i hugo_extended*
rm hugo_extended*.deb

如果出现错误:

(Reading database ... 66998 files and directories currently installed.)
Preparing to unpack hugo_extended_0.58.3_Linux-64bit.deb ...
Unpacking hugo (0.58.3) ...
dpkg: error processing archive hugo_extended_0.58.3_Linux-64bit.deb (--install):
 trying to overwrite '/usr/local/bin/hugo', which is also in package hugo_extended 0.49
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

执行:

rm -r /usr/local/bin/hugo
locate hugo_extended 0.49
rm /var/lib/dpkg/info/hugo_extended.conffiles
rm /var/lib/dpkg/info/hugo_extended.list
rm /var/lib/dpkg/info/hugo_extended.md5sums

验证安装:

hugo version
Hugo Static Site Generator v0.74.2-48565DE6/extended linux/amd64 BuildDate: 2020-07-17T17:32:27Z

如果出现错误:

-bash: /usr/bin/hugo: No such file or directory

则bash命令刷新:

bash

hugo使用:

cd /var/www
hugo new site domain.com
>Congratulations! Your new Hugo site is created in /var/www/domain.com.
hugo && varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret ban "req.http.host == domain.com"

如果出现错误:

dpkg: warning: files list file for package 'hugo_extended' missing; assuming package has no files currently installed

则:

dpkg --purge hugo_extended
dpkg: warning: files list file for package 'hugo_extended' missing; assuming package has no files currently installed
(Reading database ... 66974 files and directories currently installed.)
Removing hugo_extended (0.49) ...

© Meken 2024

Powered by Hugo & Kiss.