Total Pageviews

Thursday, 10 October 2013

在linux vps上安装基于java的静态博客程序-opoopress

首先安装 Java环境,具体如何做,请google之。

二、安装Maven

建议这样安装Maven:
apt-get install -y maven*
(yum install -y maven*)

而不要去下载apache-maven-3.1.1-bin.tar.gz文件:http://apache.mirror.anlx.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz

否则运行mvn package时,可能遇到这样的错误:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] panama
[INFO] core
[INFO] server
[INFO] client
[INFO] spring
[INFO] test
[INFO] vpn
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building panama 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building core 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/io/netty/netty-all/4.1.31.Final/netty-all-4.1.31.Final.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] panama ............................................ SUCCESS [0.002s]
[INFO] core .............................................. FAILURE [0.887s]
[INFO] server ............................................ SKIPPED
[INFO] client ............................................ SKIPPED
[INFO] spring ............................................ SKIPPED
[INFO] test .............................................. SKIPPED
[INFO] vpn ............................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.107s
[INFO] Finished at: Wed Apr 15 16:54:27 CST 2020
[INFO] Final Memory: 7M/34M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project core: Could not resolve dependencies for project org.leo.server:core:jar:1.0-SNAPSHOT: Failed to collect dependencies at io.netty:netty-all:jar:4.1.31.Final: Failed to read artifact descriptor for io.netty:netty-all:jar:4.1.31.Final: Could not transfer artifact io.netty:netty-all:pom:4.1.31.Final from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/io/netty/netty-all/4.1.31.Final/netty-all-4.1.31.Final.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :core

运行 mvn -version 命令检验是否正确地安装了 Maven。

git clone https://github.com/opoopress/opoopress-site

cd  opoopress-site

mvn package

mvn op:install (运行命令 mvn op:install 安装并初始化博客)

mvn op:generate (这个就是生成静态网站的命令,生成的文件在 target/public/site/目录,这个~/opoopress-site/target/public/site/目录就是网站的根目录,你可绑定一个域名到该目录)

要使用最新开发版的 OpooPress,请将~/opoopress-site/目录下的pom.xml改名为pom.xml.bak,把pom-SNAPSHOT.xml 改名为 pom.xml (或者不做这一步的修改也行

(参考http://www.opoopress.com/zh/docs/installation/,建议按该文的3.2部分 进行安装。不要按3.1部分安装,否则易出错)

发帖子的方法:

as3:~/opoopress-site# mvn op:new-post -Dtitle="testing6" (执行以下指令创建新文章,

mvn op:new-post -Dtitle="文章标题")

as3:~/opoopress-site# nano /root/opoopress-site/site/source/article/2013-10-10-testing6.markdown (然后在上述命令生成的空帖子的---的下面写内容, 保存更改)

as3:~/opoopress-site# mvn op:generate (每次新建/修改帖子后要记得运行该命令来更新网站,这样所写的帖子才会得以发布。)

演示站点: http://opp2.brite.biz/,http://opp3.brite.biz/

可以看到,所写的帖子全部保存在/root/opoopress-site/site/source/article/里面。

严重建议不要去改~/opoopress-site/site/里面的config.yml文件,尤其不要启用deploy settings部分,否则会发贴和更新网站都失败的。

 另外,如果发贴后(即mvn op:new-post 和mvn op:generate都无错,都显示build success,)但就是不见帖子出现在博客里,你刷新一下缓存,即可解决问题。

 发贴时,标题不建议用中文,即mvn op:new-post -Dtitle="some title name",否则易出现build failue.(帖子的内容可用中文。),而且如果标题是多个英文单词,像Wether Sunshine or Rain,不要用连字符把单词连起来,否则也易出现 build failure错误.

文章摘要

文章摘要是在博客首页显示时使用的。如果当前文章有摘要内容,则在首页显示摘要内容,并显示 继续阅读 的按钮,没有摘要内容则会显示文章全文。
 在文章正文中适当的位置插入 <!--more-->,该标记前面的内容即为文章摘要
(参考http://www.opoopress.com/zh/docs/posts/)
 
项目地址:
https://github.com/opoo/opoopress
https://github.com/opoopress/opoopress-site
 
https://github.com/opoopress/opoopress-theme-tp 
https://github.com/opoopress/opoopress-theme-default
https://github.com/opoopress/opoopress-theme-simple
https://github.com/marklma/marklma-opoopress-theme
https://github.com/marklma/marklma-opoopress-bootstrap