唐磊的个人博客

也试试github+octopress

前面讲过github写博客,然后可以绑定独立域名(方法也很简单,添加A记录只想github的page服务:207.97.227.245,上传一个CNAME内容为你的顶级域名的文件到你的代码库中)。由于手上还有一个tanglei.me域名,今天(其实是7.25,在ubuntu下用blogilo发布成草稿了,直到今天8.3才发布出来)就试着配置了下环境。效果可以看看这里

截图留念:


github和octopress配置

下面说说过程吧。

1、ruby环境。octopress要求ruby的version要>=1.9.2吧,ubuntu下默认sudo apt-get install ruby.的版本是1.8的,因此不对。可以sudo apt-get install ruby1.9.3 ,或者下载源代码 编译安装,再或者用rvm(Ruby Version Manager)之类的工具安装。

2、git clone octopress代码。并安装相关依赖包和配置, 强调下ruby的版本。看这里

3、github代码库绑定。然后就可以blog了。注意得git push一个CNAME到代码库中,不然自己的域名不会正确跳转。看这里

4、写文章.先cd your_local_octopress_directory,然后 rake new_post[“Your Title of Your Article”],在_source/_posts/目录下面生存.markdown文件。就开始吧。。。还得学学markdown。呵呵。rake generate、rake preview、reke deploy。。。

整个过程中遇到的几个问题:

  1. Do not use :apt-get install ruby,because the default version is 1.8.However octopress need 1.9.2 or later
  2. 用源代码编译安装或者用rvm安装时,运行到步骤(./configure prefix=’/usr/local/ruby’)提示configure: error: C compiler cannot create executables,我最终重新安装了GCC即可。或许你遇到了这个问题也可以重新安装GCC试试。
  3. 运行rvm总是提示:rvm is not a function,rvm use 1.9.3 will not work,并给出了个链接,参考官网 For RVM to work properly, you have to set the ‘Run command as login shell’ checkbox on the Title and Command tab inside of gnome-terminal’s Settings page。
tanglei wechat
欢迎扫码加入互联网大厂内推群 & 技术交流群,一起学习、共同进步