<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>XiaoYu&#39;s blog</title>
  
  
  <link href="/atom.xml" rel="self"/>
  
  <link href="http://yoursite.com/"/>
  <updated>2017-10-20T12:34:14.074Z</updated>
  <id>http://yoursite.com/</id>
  
  <author>
    <name>xiaoyu</name>
    
  </author>
  
  <generator uri="http://hexo.io/">Hexo</generator>
  
  <entry>
    <title>使用hexo搭建私人博客</title>
    <link href="http://yoursite.com/2017/10/13/%E4%BD%BF%E7%94%A8hexo%E6%90%AD%E5%BB%BA%E7%A7%81%E4%BA%BA%E5%8D%9A%E5%AE%A2/"/>
    <id>http://yoursite.com/2017/10/13/使用hexo搭建私人博客/</id>
    <published>2017-10-13T12:53:23.000Z</published>
    <updated>2017-10-20T12:34:14.074Z</updated>
    
    <content type="html"><![CDATA[<pre><code>使用 hexo 和 github 搭建属于自己的私人博客（本博客即通过以下操作完成）：  操作系统：ubuntu 16.04 lts    （windows下与此类似）  1、 git ：    在安装之前，可以使用命令 ： git --version 来检查一下计算机内是否已经安装 git ，如果没有安装，则使用命令 sudo apt-get install git 安装;    喝口水，git 安装完毕之后，使用如下命令进行配置：      git config --global user.name &quot;username&quot;      git config --global user.email &quot;youremail&quot;    如果没有进行这项操作，那么最后会出现问题的。2、 nodejs 与 npm ：    ubuntu apt源貌似有问题，之前使用 apt-get install 安装完毕后续操作会报错，所以在一位学长的精心提醒下，改为下载 node官网包，解压缩后安装这两个软体;    安装完毕分别使用命令 npm -v 与 nodejs -v 检查安装情况;若返回版本号，则表示安装成功。  3、 hexo    终于到hexo了，使用如下命令安装它即可： npm i -g hexo ;4、 在磁盘上找一个空闲的地，使用命令 hexo init [folder]  (假设建立的文件夹名为[folder])。hexo 会建立一个[folder]文件夹，cd [folder] 进入该文件夹；  若没有这步操作，则默认在当前文件夹建立网站，进行后续操作。  5、 本地测试生成的网站   使用命令 hexo s -g 即可；（为 hexo g , hexo s 两命令缩写;前一个命令操作为生成站点，后一命令操作为启动本地服务器）打开链接即为刚生成的页面。&lt;!more&gt;6、 软体安装完毕，接下来开始建立 github 仓库（前提是你得有github帐号，否则怎么登录？！没有的话赶紧去官网 github.com 注册一个咯！）    登录到 github ，一定要以 username.github.io 为仓库名，建立仓库，否则后续会出现问题！！！    7、 配置ssh keys（github页面上） 在 settings 中打开 SSH and GPG keys，new 一个 ssh key。在下面的输入框中填写的你本机的ssh公钥   使用命令 ssh-keygen -t rsa -C &quot;youremail&quot; 生成你的本机公钥，在你的用户目录下找到.ssh目录中的id_rsa.pub的内容，也就是你本机ssh公钥，然后点击添加。   可以使用 cat id_rsa.pub 查看其中的内容。把其中的内容复制到输入框中即可。使用命令 ssh -T git@github.com 验证是否成功。  8、修改 _config.yml文件的一些配置(冒号之后都有一个半角空格)  deploy:         type: git    repository: git@github.com:username/username.github.io.git  //这里的username改成你自己的github用户名    branch: master9、使用 hexo d 即可发布了，但是有时会出现  Deployer not found: github 或者 Deployer not found: git  ；  那么需要一步操作 npm install hexo-deployer-git --save ;原因是之前少了这个插件。  打开你的终端，输入hexo d就会将本次有改动的代码全部提交，没有改动的不会。  10、发布成功之后，若自己有域名可以绑定一下。    没有域名也不妨碍，但是无疑使用自己的域名进入博客或给别人展示时会更个性一点。    购买域名的话，一般推荐 godaddy ，国内的话腾讯云，阿里云也可以，多方比价，找到一个更合适自己的就行。    域名后缀建议.com 优先，其次.cn 在其次.com.cn ;其他的暂时不推荐。    其中.com 为国际一级域名，.cn为国家一级域名 。  11、最后了    在域名云解析的地方，添加个cname 记录，网址即为你的github仓库网址（例如username.github.io.git）；    在你的github仓库code根目录那里新建一个cname文件（无后缀名），内容为你的域名。  常用hexo命令：  hexo new &quot;postName&quot;         #新建文章  hexo new page &quot;pageName&quot;     #新建页面  hexo generate             #生成静态页面至public目录  hexo server             #开启预览访问端口（默认端口4000，&apos;ctrl + c&apos;关闭server）  hexo deploy             #部署到GitHub  hexo help              # 查看帮助  hexo version              #查看Hexo的版本  命令简写：  hexo n == hexo new  hexo g == hexo generate  hexo s == hexo server  hexo d == hexo deploy  hexo s -g         #生成并本地预览  hexo d -g         #生成并上传  以上。  </code></pre>]]></content>
    
    <summary type="html">
    
      
      
        &lt;pre&gt;&lt;code&gt;使用 hexo 和 github 搭建属于自己的私人博客（本博客即通过以下操作完成）：  

操作系统：ubuntu 16.04 lts    （windows下与此类似）  

1、 git ：  
  在安装之前，可以使用命令 ： git --versi
      
    
    </summary>
    
    
  </entry>
  
</feed>
