1. Overview 每次重装电脑都要重新安装Hexo的环境,步骤比较繁琐,所以记录下来方便之后再利用
2. Scripts 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs npm -v npm install hexo-cli -g hexo -v hexo init blog cd blognpm install git clone https://github.com/hujunhan/blogsave.git source /_posts/. hexo server git clone https://github.com/theme-next/hexo-theme-next themes/next npm un hexo-renderer-marked --save cd ..wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb sudo dpkg -i pandoc-2.7.3-1-amd64.deb cd blognpm i hexo-renderer-pandoc --save npm uninstall hexo-generator-index --save npm i hexo-generator-index2 hexo-auto-category hexo-blog-encrypt hexo-deployer-git hexo-generator-searchdb --save hexo new page categories hexo new page tags sed -i '3a type: tags' source /tags/index.md sed -i '3a type: categories' source /categories/index.md git config --global user.email "hujh@zju.edu.cn" git config --global user.name "hujunhan" ssh-keygen cat /home/coding/.ssh/id_rsa.pub
3. Deploy 4. Custom Domain Prerequisite: A custom domain
设置步骤:
在域名购买商处设置一条解析规则, 记录设置为CNAME(用于github.io)或者A(用于IPv4地址)
在github的项目处设置Custom Domain, 这会在项目根目录下新建一个CNAME文件, 文件内容就是想要的Custom Domain.
因为每次Hexo deploy之后CNAME文件都会被删除, 所以需要在Hexo项目中加入CNAME文件来解决这个问题. 在blog/source/目录下新建CNAME文件, 文件内容是想要的Custom Domain.
5. Link 1 ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/MarkdownNotes ~/blog/source/_posts