当前位置: 首页 > 后端技术 > Node.js

GitHub+Hexo搭建博客站点

时间:2023-04-03 14:18:50 Node.js

Hexo是一个基于Node.js的静态博客框架。它具有很少的依赖性,并且易于安装和使用。它可以轻松生成静态网页并将其托管在GitHub和Heroku上。它是构建博客的首选框架。配置Githubroot@hello:~/cby#gitconfig--globaluser.name"cby-chen"root@hello:~/cby#gitconfig--globaluser.email"cby@chenby.cn"root@hello:~/cby#ssh-keygen-trsa-C"cby@chenby.cn"生成公/私rsa密钥对。输入保存密钥的文件(/root/.ssh/id_rsa):输入密码(为空表示没有passphrase):再次输入同样的passphrase:你的身份已经保存在/root/.ssh/id_rsa你的公钥已经保存在/root/.ssh/id_rsa.pub密钥指纹是:SHA256:57aHSNuHDLRsy/UVOQKwrUmpKOqnkEbRuRc8jNrGVpUcby@chenby.cn密钥的随机艺术图像是:+---[RSA3072]----+|.o.||.=.E+。||.+*+..||=o.oo.o。+||o.*...oS..o||.oo..*o。.||+。+哦+。||+。=.=.+||oo.o|+----[SHA256]-----+root@hello:~/cby#cat/root/.ssh/authorized_keysid_rsaid_rsa.pubknown_hosts#需要配置到github上#https://github.com/settings/ssh/newroot@hello:~/cby#sshgit@github.com无法确定主机'github.com(20.205.243.166)'的真实性。ECDSA密钥指纹为SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM。Areyousureyouwanttocontinueconnecting(yes/no/[指纹])?是警告:将“github.com,20.205.243.166”(ECDSA)永久添加到已知主机列表中。通道0上的PTY分配请求失败嗨cby-chen!您已成功通过身份验证,但GitHub不提供shell访问。与github.com的连接已关闭。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#nvminstall--lts正在安装最新的LTS版本。正在下载并安装节点v16.13.1...正在下载https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz...###############################################################################################################################################100.0%计算校验和与sha256sumChecksums匹配!现在使用节点v16.13.1(npmv8.1.2)root@hello:~/cby#nvmuse--ltsNowusingnodev16.13.1(npmv8.1.2)root@hello:~/cby#root@hello:~/cby#node-vv16.13.1root@hello:~/cby#配置hexo环境,修改主题root@hello:~/cby#npminstall-ghexo-cliroot@hello:~/cby#npminstallhexo-groot@hello:~/cby#npmupdatehexo-groot@hello:~/cby#hexoinitINFO克隆hexo-starterhttps://github.com/hexojs/hexo-starter.gitINFOInstalldependenciesINFO开始用Hexo写博客吧!#修改主题root@hello:~/cby#rm-rfscaffoldssourcethemes_config.landscape.yml_config.ymlpackage.jsonyarn.lockroot@hello:~/cby#gitclonehttps://github.com/V-Vincen/hexo-theme-livemylife.gitroot@hello:~/cby#mvhexo-theme-livemylife/*./root@hello:~/cby#rm-rfhexo-theme-livemyliferoot@hello:~/cby#npminstall修改配置文件root@hello:~/cby#vim_config.ymlroot@hello:~/cby#root@hello:~/cby#root@hello:~/cby#cat_config.yml#略#部署##文档:https://hexo.io/docs/deployment.html##deploy:type:gitrepo:https://github.com/cby-chen/cby-chen.github.io.git#或者https://gitee.com//branch:masterroot@hello:~/cby#root@hello:~/cby#hexocleanroot@hello:~/cby#hexogroot@hello:~/cby#hexod#注意输入密码需要输入token,创建时需要勾选所有权限#https://github.com/settings/tokens/newLinux运维交流社区Linux运维交流社区,互联网新闻与技术交流79原创内容公众号https://www.oiox.cn/https://www.chenby.cn/https://cby-chen.github.io/https://weibo.com/u/5982474121https://博客。csdn.net/qq\_33921750https://my.oschina.net/u/3981543https://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、知乎、开源中国、师傅、掘金、简书、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客、全网都能搜到《小陈运维》