文章

Hugo安装部署

两个版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
源码网站
https://github.com/gohugoio/hugo/releases

原版
hugo_0.106.0_linux-amd64.tar.gz

扩展版本
hugo_extended_0.106.0_linux-amd64.tar.gz 


扩展版本是为了加载 SCSS/SASS 文件 与普通css文件不一样
报错: 
ERROR 2022/12/02 23:32:13 TOCSS: failed to transform "sass/main.scss" (text/x-scss). Check your Hugo installation; you need the extended version to build SCSS/SASS.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information



主题网站选择:
https://themes.gohugo.io

安装(扩展版)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
下载压缩包之后

直接解压得到文件
.
├── hugo
├── LICENSE
└── README.md

ln -sf /path_to_path/hugo /user/bin/
直接运行即可

运行报错,依赖有问题:
hugo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by hugo)
hugo: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by hugo)
hugo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by hugo)

做的操作:
1. yum update glibc

2.  wget http://mirror.ghettoforge.org/distributions/gf/el/7/gf/x86_64/gf-release-7-12.gf.el7.noarch.rpm
rpm -Uvh gf-release-7-12.gf.el7.noarch.rpm
rpm -ql gcc10-libstdc++.x86_64
cp /opt/gcc-10.2.1/usr/lib64/libstdc++.so.6.0.28 /usr/lib64/
cd /usr/lib64
mv libstdc++.so.6 /tmp/
ln -s libstdc++.so.6.0.20 libstdc++.so.6

3. 执行上面的之后还是报错
hugo: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

4. yum install libstdc++-devel.i686

第4步之后可以了

常用命令

1
2
3
4
5
6
7
8
9
10
11
创建模版文件: mysite 我的网站名称
hugo new site mysite

启动服务
hugo server  

使用以下命令创建一个新帖子:
hugo new posts/my-first-post.md



本文由作者按照 CC BY 4.0 进行授权