环境

Git

  • Windows:下载并安装 git这篇教程写的相当全了
  • Mac:使用 Homebrew, MacPorts 或者下载 安装程序。
  • Linux (Ubuntu, Debian):sudo apt-get install git-core
  • Linux (Fedora, Red Hat, CentOS):sudo yum install git-core

验证成功
当你右键能看到git bash here 和git gui here 说明你安装成功了

Node

安装Node

最后验证是否安装成功 Win+r

输入node -v npm -v git -v

1
2
3
4
5
6
7
8
C:\Users\Ganxy>node -v
v18.16.0

C:\Users\Ganxy>git -v
git version 2.40.1.windows.1

C:\Users\Ganxy>npm -v
9.6.6

正确的输出版本号即可

下载

Hexo

新建一个文件夹 在文件夹内git bash here
安装Hexonpm install hexo

然后npx hexo <文件名> 或者 hexo init <文件名>

新建的文件夹内便是本地Hexo站点目录

本地Hexo目录

若报错bash: hexo: command not found
那就将node_modules/bin 目录配置到环境变量path再init

这里是官方文档

部署

本地部署

1
2
3
hexo g

hexo s

浏览器打开http://localhost:4000/
能看到这个说明本地部署成功!
本地部署成功
接下来就差优化啦~

服务器部署

Github/Gitee静态页面托管

首先要本地生成ssh密钥
将本地的密钥添加到github的ssh keys
这样本地就可以直接上传文件至github上的仓库
随后再根目录的配置文件_config.yml配置git地址
如下:

1
2
3
4
deploy:
type: git
repo: https://github.com/Ganxy03/Ganxy03.github.io
branch: gh-pages
服务器

这个我自个都还没弄嘞

优化

这是我用的主题matery(点击下载压缩包)

1
2
下载地址:http://download.ganxy03.cn/download/hexo-theme-matery-master.zip

下载完再在根目录下的配置文件把主题默认的改成这个主题的全名

1
2
3
4
5
6
7
如:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: hexo-theme-matery

注意:#号是修饰符 注释语句课忽略

至于其他的个性化配置 去翻作者的说明文档吧
放这了