<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>润物无声 &#187; Octopress</title>
	<atom:link href="http://blog.zhourunsheng.com/tag/octopress/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zhourunsheng.com</link>
	<description>天空一朵雨做的云</description>
	<lastBuildDate>Sat, 08 May 2021 05:17:21 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>利用GitHub Pages安装部署Octopress博客</title>
		<link>http://blog.zhourunsheng.com/2012/04/%e5%88%a9%e7%94%a8github-pages%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2octopress%e5%8d%9a%e5%ae%a2/</link>
		<comments>http://blog.zhourunsheng.com/2012/04/%e5%88%a9%e7%94%a8github-pages%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2octopress%e5%8d%9a%e5%ae%a2/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 11:59:49 +0000</pubDate>
		<dc:creator><![CDATA[润物无声]]></dc:creator>
				<category><![CDATA[Web设计]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[Octopress]]></category>

		<guid isPermaLink="false">http://blog.zhourunsheng.com/?p=1472</guid>
		<description><![CDATA[<p>周末闲来无事，学习了一下怎样利用github pages来建立自己的博客，现在比较成熟的博客系统是Octopr [&#8230;]</p>
<p><a rel="nofollow" href="http://blog.zhourunsheng.com/2012/04/%e5%88%a9%e7%94%a8github-pages%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2octopress%e5%8d%9a%e5%ae%a2/">利用GitHub Pages安装部署Octopress博客</a>，首发于<a rel="nofollow" href="http://blog.zhourunsheng.com">润物无声</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>周末闲来无事，学习了一下怎样利用github pages来建立自己的博客，现在比较成熟的博客系统是<a href="http://octopress.org/">Octopress</a>，关于其详细的介绍可以参见官方文档，本文建立的博客页面已经绑定到了<a href="http://zhourunsheng.com/">zhourunsheng.com</a>域名，可以查看博客的效果！<span id="more-1472"></span></p>
<h3>1. github page 的建立</h3>
<p>要想在github上面建立自己的博客，首先需要建立page，可以参考官方的文档 <a href="http://help.github.com/pages/">http://help.github.com/pages/</a>，简单来说，比如我的github账户名称是careychow，那么需要建立一个 careychow.github.com 的 repository，将博客的静态页面上传到该repository的master分支中，当通过浏览器访问 http://careychow.github.com的时候，github服务器就会将其中博客页面展示出来。</p>
<h3>2. 搭建 Octopress 本地环境</h3>
<p>linux 环境的搭建可以参见官方文档 <a href="http://octopress.org/docs/setup/">http://octopress.org/docs/setup/</a></p>
<p>因为我自己通常都在win7下面办公，所以下面介绍一下win7环境下 Octopress 的搭建和部署</p>
<p>a. 安装 git，下载地址：<a href="http://code.google.com/p/msysgit/downloads/list">msysgit</a>，最新版本 <a href="http://msysgit.googlecode.com/files/Git-1.7.10-preview20120409.exe">Git-1.7.10-preview20120409.exe </a>，详细参见 <a href="http://help.github.com/win-set-up-git/">http://help.github.com/win-set-up-git/</a></p>
<p>b.安装 ruby，下载地址: <a href="http://rubyforge.org/frs/?group_id=167">RubyInstaller</a>，安装版本 <a href="http://rubyforge.org/frs/download.php/75127/rubyinstaller-1.9.2-p290.exe">rubyinstaller-1.9.2-p290.exe</a>，注意版本是1.9.2</p>
<p>c. 安装gem编译环境， 下载地址：<a href="https://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe">DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe</a>，下载完成后，将其解压到 如 E:\DevKit，然后在win的cmd窗口中执行如下命令进行安装：</p>
<pre>cd E:\DevKit
ruby dk.rb init
ruby dk.rb instal</pre>
<p>e. 安装python，下载地址：<a href="http://www.activestate.com/activepython">activepython</a> ，安装2.7版，主要是博客代码加亮模块需要python环境的支持，安装完以后，在win的cmd窗口中执行：</p>
<pre> easy_install pygments </pre>
<h3>3. 更新配置</h3>
<p>a. 中文 utf-8 编码的支持，在win7环境变量中配置如下：</p>
<pre>LANG=zh_CN.UTF-8
LC_ALL=zh_CN.UTF-8</pre>
<p>b. 变更 gem 的更新源，ruby的官方更新源经常被河蟹，木有办法，幸亏国内有淘宝做好事，提供了国内的更新源，这样速度就快多了，变更如下：</p>
<pre>gem sources --remove http://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem sources -l
注意 ：请确保只有 http://ruby.taobao.org/ 唯一一个条目</pre>
<p>c. 安装 rdoc 和 bundler</p>
<pre>gem install rdoc bundler</pre>
<h3>4. 安装 Octopress</h3>
<p>a. 下载 Octopress 源码</p>
<pre>git clone git://github.com/imathis/octopress.git octopress
cd octopress # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes).
ruby --version # Should report Ruby 1.9.2</pre>
<p>b. 安装依赖模块</p>
<pre>$ vi Gemfile
将行 ： source "http://rubygems.org/"
改为 ： source "http://ruby.taobao.org/"
$ bundle install</pre>
<p>c. 安装 默认主题</p>
<pre>rake install</pre>
<pre>如若出错：
$ rake install
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.
(See full trace by running task with --trace)
修正办法为：
$ bundle update; rake install</pre>
<h3>5. 发布博客到github pages</h3>
<p>a. 与github建立连接</p>
<pre>rake setup_github_pages
按照提示输入 github page repository的url地址，例如：git@github.com:careychow/careychow.github.com.git</pre>
<p>b. 生成静态页面</p>
<pre>rake generate</pre>
<p>c. 本地预览，访问 <a href="http://localhost:4000">http://localhost:4000 </a>查看博客本地运行效果</p>
<pre>rake preview</pre>
<p>e. 发送到github 服务器，访问 <a href="http://careychow.github.com">http://careychow.github.com</a> 查看博客服务器运行效果</p>
<pre>rake deploy</pre>
<p>f. 保存博客源码到github source分支</p>
<pre>git add .
git commit -m 'blog source'
git push origin source</pre>
<h3>6. 配置 Octopress</h3>
<p>a. 更新配置文件 octopress/_config.yml, ，参考<a href="http://octopress.org/docs/configuring/">http://octopress.org/docs/configuring/</a>，示例如下，若包含中文，请将文件格式保存成utf-8的格式</p>
<pre>url: http://zhourunsheng.com
title: 润物无声
subtitle: 天空一朵雨做的云
author: Carey Chow
simple_search: http://google.com/search
description:</pre>
<p>b. 绑定个人域名</p>
<pre>echo 'zhourunsheng.com' &gt;&gt; octopress/source/CNAME
修改域名 'zhourunsheng.com'  A记录到 207.97.227.245</pre>
<p>c. 创建新文章和新页面</p>
<pre>rake new_post["article name"]
rake new_page["page name"]</pre>
<p>d. 发布到github个人空间</p>
<pre>rake generate
rake deploy</pre>
<p>至此，一个完整的博客就搭建完毕了，具体的运行效果图请参见我的示例空间：<a href="http://zhourunsheng.com/">http://zhourunsheng.com/</a></p>
<p><a rel="nofollow" href="http://blog.zhourunsheng.com/2012/04/%e5%88%a9%e7%94%a8github-pages%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2octopress%e5%8d%9a%e5%ae%a2/">利用GitHub Pages安装部署Octopress博客</a>，首发于<a rel="nofollow" href="http://blog.zhourunsheng.com">润物无声</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zhourunsheng.com/2012/04/%e5%88%a9%e7%94%a8github-pages%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2octopress%e5%8d%9a%e5%ae%a2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
