hexo 安装部署

安装基础环境

yum install epel-release -y
yum install gcc gcc-c++ -y
yum install wget -y
yum install git -y

下载最新版的node

## 安装node
wget https://registry.npmmirror.com/-/binary/node/latest-v17.x/node-v17.9.0-linux-x64.tar.gz
[root@localhost ~]# tar -xvf node-v17.9.0-linux-x64.tar.gz 

[root@localhost ~]# ls
anaconda-ks.cfg  node-v17.9.0-linux-x64  node-v17.9.0-linux-x64.tar.gz
[root@localhost ~]# mv node-v17.9.0-linux-x64 node
[root@localhost ~]# mv node /usr/local/
## 设置环境变量
[root@localhost ~]# vim /etc/profile
# /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
"/etc/profile" 80L, 1889C written                                                                                                                                        
[root@localhost ~]# source /etc/profile
## 确认安装
[root@localhost ~]# node --version
v17.9.0

升级到8.6.0

[root@localhost ~]# npm --version
8.5.5
[root@localhost node]# npm install -g [email protected]
[root@localhost node]# npm -version
8.6.0

安装hexo

[root@localhost node]# npm install hexo-cli


[root@localhost ~]# cat ~/.profile 
PATH="$PATH:/usr/local/node_modules/.bin"
[root@localhost ~]# source ~/.profile 

Install dependencies:

$ git clone https://github.com/hexojs/site.git
$ cd site
$ npm install

Generate:

$ hexo generate

Run server:

$ hexo server

[root@localhost ~]# npm install -S hexo-generator-json-content

added 3 packages, and audited 63 packages in 5s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[root@localhost ~]# npm install hexo-generator-searchdb --save


search:
  path: search.xml
  field: post
  content: true
  format: html

added 5 packages, and audited 68 packages in 6s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[root@localhost ~]# npm install hexo-generator-search --save  

added 2 packages, and audited 70 packages in 4s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[root@localhost ~]# 

你可能感兴趣的:(Linux,服务器)