Hexo是一款基于Node.js的动态博客框架,依赖少易于装置应用,能够不便的生成动态网页托管在GitHub和Heroku上,是搭建博客的首选框架。

配置Github

root@hello:~/cby# git config --global user.name "cby-chen"root@hello:~/cby# git config --global user.email "cby@chenby.cn"root@hello:~/cby# ssh-keygen -t rsa -C "cby@chenby.cn"Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsaYour public key has been saved in /root/.ssh/id_rsa.pubThe key fingerprint is:SHA256:57aHSNuHDLRsy/UVOQKwrUmpKOqnkEbRuRc8jNrGVpU cby@chenby.cnThe key's randomart image is:+---[RSA 3072]----+|       .o.       ||  . = .E +.      || . + *  + ..   . ||  = o.oo.o  . +  || o.*...oS..  . o ||.oo..   *o.   .  ||+.     + Oo+ .   ||+  .    =.=.+    || oo       .o     |+----[SHA256]-----+root@hello:~/cby# cat /root/.ssh/authorized_keys  id_rsa           id_rsa.pub       known_hosts      #须要配置到github上#https://github.com/settings/ssh/newroot@hello:~/cby# ssh git@github.comThe authenticity of host 'github.com (20.205.243.166)' can't be established.ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWarning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.PTY allocation request failed on channel 0Hi cby-chen! You've successfully authenticated, but GitHub does not provide shell access.Connection to github.com closed.root@hello:~/cby#

*将id\_rsa.pub文件中的内容粘贴进去

装置nvm工具

root@hello:~/cby# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashroot@hello:~/cby# nvm install --ltsInstalling latest LTS version.Downloading and installing node v16.13.1...Downloading https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz...############################################################################################################################################### 100.0%Computing checksum with sha256sumChecksums matched!Now using node v16.13.1 (npm v8.1.2)root@hello:~/cby# nvm use --ltsNow using node v16.13.1 (npm v8.1.2)root@hello:~/cby# root@hello:~/cby# node -vv16.13.1root@hello:~/cby#

配置hexo环境,并批改主题

root@hello:~/cby# npm install -g hexo-cli root@hello:~/cby# npm install hexo -groot@hello:~/cby# npm update hexo -g root@hello:~/cby# hexo initINFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.gitINFO  Install dependenciesINFO  Start blogging with Hexo!#批改主题root@hello:~/cby# rm -rf scaffolds source themes _config.landscape.yml _config.yml package.json yarn.lockroot@hello:~/cby# git clone https://github.com/V-Vincen/hexo-theme-livemylife.gitroot@hello:~/cby# mv hexo-theme-livemylife/* ./root@hello:~/cby# rm -rf hexo-theme-livemyliferoot@hello:~/cby# npm install

批改配置文件

root@hello:~/cby# vim _config.ymlroot@hello:~/cby# root@hello:~/cby# root@hello:~/cby# cat _config.yml#略# Deployment## Docs: https://hexo.io/docs/deployment.html##deploy:  type: git  repo: https://github.com/cby-chen/cby-chen.github.io.git # or https://gitee.com/<yourAccount>/<repo>  branch: masterroot@hello:~/cby# root@hello:~/cby# hexo clean root@hello:~/cby# hexo g root@hello:~/cby# hexo d#留神,输出明码是须要输出token,创立时须要勾选所有权限#https://github.com/settings/tokens/new

Linux运维交换社区

Linux运维交换社区,互联网新闻以及技术交换。

79篇原创内容

公众号

https://www.oiox.cn/

https://www.chenby.cn/

https://cby-chen.github.io/

https://weibo.com/u/5982474121

https://blog.csdn.net/qq\_33921750

https://my.oschina.net/u/3981543

https://www.zhihu.com/people/...

https://segmentfault.com/u/hp...

https://juejin.cn/user/331578...

https://space.bilibili.com/35...

https://cloud.tencent.com/dev...

https://www.jianshu.com/u/0f8...

https://www.toutiao.com/c/use...

CSDN、GitHub、知乎、开源中国、思否、掘金、简书、腾讯云、哔哩哔哩、今日头条、新浪微博、集体博客、全网可搜《小陈运维》