Hexo 博客搭建

Hexo 博客搭建

假设系统用户名为test

Github账号为 test@163.com

1. 在 Linux 系统中安装 Git

sudo apt-get install git-core

2. 在 Linux 系统中安装 Node.js

Node.js v19.x为例

curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

3. 安装 Hexo

sudo npm install -g hexo-cli

4. 执行 Hexo

创建并进入工作目录,如 ~/Hexo

cd ~
mkdir Hexo
cd Hexo

使用 hexo init 新建 Hexo 项目:

hexo init my-hexo-site
cd my-hexo-site
npm install

5. 创建帖子

hexo new "hello hexo"

在 hello-hexo.md 中编写文章

6. 创建 Github 仓库

创建 Githubi 仓库,比如 my-hexo-site

Picture1

7. 配置 Github 账户

7.1 生成 SSH Key

git ssh-keygen -t ed25519 -C "test@163.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/test/.ssh/id_ed25519): [Press enter]
Created directory '/home/test/.ssh'.
Enter passphrase (empty for no passphrase): [Press enter]
Enter same passphrase again: [Press enter]
Your identification has been saved in /home/test/.ssh/id_ed25519
Your public key has been saved in /home/test/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx your_email@example.com
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
+----[SHA256]-----+

7.2 将 public key 添加到 Github

打开 Github 的 Settings
Picture2

将 /home/test/.ssh 内容添加到 SSH Key
Picture3

8 配置 Git 提交的账户

git config --global user.email "test@163.com"
git config --global user.name "test"

9. 将 Hexo 推送到 Github 仓库

cd my-hexo-site
git init
git remote add origin git@github.com:test/my-hexo-site.git
git add .
git commit -m "first commit"
git branch -M main
git push -u origin main

10. 使用 Cloudflare Page 部署 Hexo

创建一个 Page 项目
Picture4

连接到 Github
Picture5

开始配置
Picture6

配置构建参数
Picture7

posted @   CODESYS部落格  阅读(23)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
点击右上角即可分享
微信分享提示