首先你要编译python3环境,
需先编译python3.3.3环境:
wget http://python.org/ftp/python/3.3.3/Python-3.3.3.tar.bz2
tar jxvf Python-3.3.3.tar.bz2
cd Python-3.3.3
./configure --prefix=/usr/local/python-3.3.3
make
make install
ln -s /usr/local/python-3.3.3/bin/python3.3 /usr/local/bin/python3.3
还要安装python3.3的markdown模块:
# wget http://python-distribute.org/distribute_setup.py
# python3.3 distribute_setup.py
(这2步是安装easy_install程序)
会显示:
...
Installing easy_install script to /usr/local/python-3.3.3/bin
Installing easy_install-3.3 script to /usr/local/python-3.3.3/bin
...
# /usr/local/python-3.3.3/bin/easy_install-3.3 markdown
(/usr/local/python-3.3.3/bin/easy_install-3.3 pip)
然后是安装jdk1.7,运行java -version
须显示
java version "1.7.0_03"。我机子上运行java -version后,显示openjdk1.6,这是不行的。解决办法:
mv /usr/bin/java /usr/bin/java-openjdk-version
ln -s /root/jdk1.7.0_03/bin/java /usr/bin/java
( jdk1.7.0_03的压缩包文件请到www.oracle.com去下载)
git clone https://github.com/chaopeng/chaosblog.git
cd chaosblog
as3:~/chaosblog# ls
builder LICENSE publish README.md to-be-publish
as3:~/chaosblog# cd to-be-publish
as3:~/chaosblog/to-be-publish# ls
buildBlog.bat _component index.html navibar
buildblog.sh _config.json _layout post
chaosblog.jar _config_linux.json log.log _template
as3:~/chaosblog/to-be-publish# ./buildblog.sh
2013-11-29 10:12:56 INFO [main] [main.ChaosBlog] - start...
2013-11-29 10:12:58 INFO [main] [main.ChaosBlog] - output finish
as3:~/chaosblog/to-be-publish# nano _config_linux.json (编辑配置文件)
as3:~/chaosblog/to-be-publish# cat _config_linux.json
显示:
BlogConfig
{
site: "chaosblog.brite.biz", (这里英文双引号里替换为你的域名)
path: "/blog", (这里path的值不能为/,必须为某个子目录,比如/blog)
author: "ym",
blogname: "ym的Pensive",
# set the markdown engine which you like
markdownengine: "/usr/local/python-3.3.3/bin/python3.3 -m markdown -x toc -x footnotes -x fenced_code -x tables",
inputpath: "/root/chaosblog/to-be-publish",
outputpath: "/root/chaosblog/publish/" (这里不要加英文逗号)
}
...
(这里/root/chaosblog/publish/就是静态网站的根目录)
as3:~/chaosblog/to-be-publish# mkdir /root/chaosblog/publish/blog
as3:~/chaosblog/to-be-publish# cd /root/chaosblog/publish/
as3:~/chaosblog/publish# ls
blog
as3:~/chaosblog/publish# git clone https://github.com/chaopeng/chaopeng.github.com.git
as3:~/chaosblog/publish# cd chaopeng.github.com
as3:~/chaosblog/publish/chaopeng.github.com# ls
assets CNAME httpserver.bat index.html
blog favicon.ico httpserver.sh publish.sh
as3:~/chaosblog/publish/chaopeng.github.com# mv assets ~/chaosblog/publish/
as3:~/chaosblog/publish/chaopeng.github.com# cd ~/chaosblog/publish/
as3:~/chaosblog/publish# ls
assets blog chaopeng.github.com
as3:~/chaosblog/publish# rm -rf chaopeng.github.com
as3:~/chaosblog/publish# nano index.html
(新建一个跳转用的index.html,这样访问静态网站的根目录~/chaosblog/publish/时,就会跳转到~/chaosblog/publish/blog/)
as3:~/chaosblog/publish# cat index.html
<meta HTTP-EQUIV=REFRESH CONTENT="0;URL=http://chaosblog.brite.biz/blog/">
as3:~/chaosblog/publish# ls
assets blog index.html
as3:~/chaosblog/publish# cp index.html assets/
(复制index.html到assets目录,这样当有人访问http://chaosblog.brite.biz/assets时,这样就会跳转到
http://chaosblog.brite.biz/blog/,从而保护~/chaosblog/publish/assets/不被人访问)
发贴方法:
as3:~/chaosblog/publish# cd ~/chaosblog/to-be-publish/post/
as3:~/chaosblog/to-be-publish/post# ls
2013-01-05-test-markdown.md 2013-01-06-why-chaosblog.md
按2013-01-05-test-markdown.md的格式,新建帖子2013-11-29-test1.md,格式如下:
{
layout: "pages",
title: "测试1",
category: "misc",
tags: ["test"]
}
这是测试1.
然后:
as3:~/chaosblog/to-be-publish/post# cd ..
as3:~/chaosblog/to-be-publish# ./buildBlog.sh (这个就是生成/更新静态网站的命令)
演示站点:http://chaosblog.brite.biz/
项目地址:https://github.com/chaopeng/chaosblog