Hexo 博客系列(五) Debian 部署 Hexo

安装GIT

1
2
3
4
5
6
7
8
#切换到root用户
sudo -i
# 检查是否安装git
git -v
# 安装git
apt install git -y
# 查看版本
git -v

安装NODE.JS

参照官网

1
2
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\
apt-get install -y nodejs

安装提示

1
2
3
4
5
6
7
## Run `sudo apt-get install -y nodejs` to install Node.js 20.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

yarnnpm的下一代产品,这里用不到,只安装development tools即可

1
sudo apt-get install gcc g++ make -y

验证查看版本

1
2
npm --version
node --version

安装hexo

全局安装 Hexo

npm install -g hexo-cli

初始化 Hexo

mkdir hexo
cd hexo
hexo init

测试

hexo s

返回

INFO  Start processing
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.

浏览器localhost:4000进行预览