感谢 tctia***** 的支持。
有用户要求测试安装Ambra,现将过程记录,虽然未成功,但希望给其他人带来帮助。
环境:
软件:Debian 7.10 64位,JDK 7,tomcat 6,mysql server 5.5。
ECS配置:1核心,2GB内存。
个人总结:
a. Ambra官方网站里的文档相对较旧,很久没更新了
b. Ambra官方网站里提供的联系方法(邮件列表)无人审核,无法发邮件提问,获取帮助
c. Java生手(如我),不建议尝试,在前面两个原因前提下,完成测试有难度
过程:
1. 更新软件源:
apt-get update
2. 安装默认JDK版本(1.7.0_111)
apt-get install default-jdk
3. 安装tomcat6
apt-get install tomcat6
4. 安装mysql,假设设置mysql的密码为root
apt-get instal mysql-server
5. 停止 tomcat6 服务,移走原有/var/lib/tomcat/webapps目录内容
service tomcat6 stop
6. 用官方上手教程里方法,编译的webapp版本是2.9.5,官方PLOS支是2.11,这里下载官方编译好的2.11.war来测试,放到 /var/lib/tomcat/webapps/ROOT.war
wget http://ambraproject.org/maven2/release/org/ambraproject/ambra-webapp/2.11.0/ambra-webapp-2.11.0.war
7. 从官方上手教程里下载相应的组件,如 tomcat-jdbc.jar, tomcat-juli.jar, log4j-1.2.14.jar 到 /usr/share/tomcat6/lib 目录(前两者是mysql连接要用到的,后边的是用于记录日志的),同时在该目录里创建log4j.properties的配置文件,让tomcat记录详细的输出信息
log4j.rootLogger=ERROR,consoleAppender
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.Target=System.out
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=%-5p %c{1} - %m%n
log4j.logger.org.ambraproject=DEBUG
log4j.logger.org.ambraproject.ambra.configuration=FATAL
8. 编辑tomcat配置文件,/etc/tomcat6/context.xml ,在<Context>标签间加入以下内容,其中 jdbc:mysql://localhost/ambra 中的 ambra 是程序要用到的数据库名称,上一行的password是数据库用户的密码,路径 /mytest/dongshan/ambra 是程序要用到的文件路径,这里随意创建了 /mytest/dongshan 的路径,请作相应的更改
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource name="jdbc/AmbraDS"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
validationQuery="SELECT 1"
testOnBorrow="true"
driverClassName="com.mysql.jdbc.Driver"
username="root"
password="aqtest38"
url="jdbc:mysql://localhost/ambra" />
<Resource name="ambra/FileStore"
type="org.ambraproject.filestore.FileStoreService"
factory="org.ambraproject.filestore.impl.LocalFileStoreFactory"
baseDir="/mytest/dongshan"
domain="ambra" />
9. 创建好空数据库 ambra,导入从官方“上手教程”里的 ambra_schema.sql 数据库文件
10.创建ambra的配置文件,/etc/ambra/ambra.xml ,内容如下。这里主要是设置文件(ehcache.xml)和目录(ingest、ingestdestination、AmbraJournal和templates)的路径, 还有默认杂志名称(AmbraJournal),请根据实际情况修改:
<config>
<ambra>
<network>
<hosts>
<default>localhost</default>
<ambra>${ambra.network.hosts.default}</ambra>
</hosts>
</network>
<services>
<ehcache>
<configFileLocation>/mytest/dongshan/ehcache.xml</configFileLocation>
</ehcache>
<search>
<server>
<url>http://localhost:8080/solr</url>
</server>
</search>
<documentManagement>
<ingestSourceDir>/mytest/dongshan/ingest</ingestSourceDir>
<ingestDestinationDir>/mytest/dongshan/ingestdestination</ingestDestinationDir>
</documentManagement>
</services>
<virtualJournals>
<templateDir>/mytest/dongshan/templates</templateDir>
<default>AmbraJournal</default>
<journals>AmbraJournal</journals>
</virtualJournals>
</ambra>
</config>
11.创建杂志目录(/mytest/dongshan/templates/journals/AmbraJournal/webapp)及配置文件,如 /mytest/dongshan/templates/journals/AmbraJournal/configuration/journal.xml,内容如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
This file is the Ambra template for the Default AmbraJournal journal
-->
<config>
<ambra>
<!-- virtual journal config -->
<virtualJournals>
<AmbraJournal>
<journal>AmbraJournal</journal>
<eIssn>1111-2222</eIssn>
<description>Ambra</description>
<rules>
<host>.*ambra.*</host>
</rules>
<url>http://ambrajournal.example.org</url>
<!-- Does the journal have a taxonomy browser? -->
<taxonomyBrowser>false</taxonomyBrowser>
<ambra>
<services>
<feed>
<title>Ambra Journal</title>
<id>info:doi/10.1371/feed.ambr</id>
</feed>
</services>
</ambra>
<!-- Configuration keys for displaying recent articles tab widget on home page -->
<recentArticles>
<numDaysInPast>14</numDaysInPast>
<numArticlesToShow>5</numArticlesToShow>
<typeUriArticlesToShow>
<articleTypeUri>http://rdf.plos.org/RDF/articleType/Research%20Article</articleTypeUri>
</typeUriArticlesToShow>
</recentArticles>
<isIncludeInCrossJournalSearch>false</isIncludeInCrossJournalSearch>
</AmbraJournal>
</virtualJournals>
<freemarker>
<!--
# This section defines the various journals and the css and javascript files which should be
# included on each page as well as the page title. The values within the <default> tag are used
# if any of the values are missing in the <page> definitions. Note, that the title, css, and
# javascript level values are entirely replaced, they are not additive. Override config files
# may define values for each of those three variables and they will supsercede values present
# in subsequent config values. The lookup for values is as follows:
# 1. Page defined in journal
# 2. Default value defined in journal
# 3. Page defined in default journal
# 4. Default value in default journal
# To define an empty value for a certain page so that it doesn't use defaults, just put the
# element tag with no value, e.g. <javascript></javascript>
-->
<!--AmbraJournal-->
<journal>
<name>AmbraJournal</name>
<metaKeywords>Ambra\, Default\, Journal</metaKeywords>
<metaDescription>Ambra Journal: Defaults</metaDescription>
<articleTitlePrefix>Ambra Journal :</articleTitlePrefix>
<displayName>Ambra Journal</displayName>
<default>
<title>Ambra Journal : An Open-Access, Semantic, Journal Publishing System</title>
<css>
<file>/css/global.css</file>
<file>/css/lte_ie7.css</file>
</css>
<javascript>
<file>/javascript/js.js</file>
</javascript>
</default>
<page>
<name>/index.ftl</name>
<css>
<file>/css/global.css</file>
<file>/css/lte_ie7.css</file>
</css>
<javascript>
<file>/javascript/jquery-1.8.1.js</file>
<file>/javascript/global.js</file>
</javascript>
</page>
</journal>
</freemarker>
</ambra>
</config>
12.如果tomcat6提示缺少co请在相应的镜像站点下载 commons-logging-1.2-bin.tar.gz,将解压出来commons-logging-1.2.jar的文件,放到tomcat的lib目录/usr/share/tomcat6/lib
wget http://apache.mirror.iweb.ca//commons/logging/binaries/commons-logging-1.2-bin.tar.gz
13.启动tomcat6,在浏览器访问,看测试结果:
service tomcat6 start
14.如浏览器显示404页面找不到,请查看tomcat日志:
tail -300 /var/log/tomcat6/catalina.out
15.测试中,如果用官方PLOS树中的ambra-webapp-2.11.0.war,很可能会出现500错误,提示找不到 includes/article_variables.ftl 文件,我是直接将 /var/lib/tomcat6/webapps/ROOT/includes/global_variables.ftl 复制为 /var/lib/tomcat6/webapps/ROOT/includes/article_variables.ftl
freemarker.template.TemplateException: Error reading included file includes/article_variables.ftl
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。