zoukankan      html  css  js  c++  java
  • Java开源Blog实现,Roller 2.0 的安装手记!



    Roller 是一个Struts + Hibernate 的 Java 开源实现,正好拿来研究研究,首先就是要把它安装起来了,整理
    了一下步骤和注意事项,记录如下:

    准备需要的基本环境:

    1. Java 2 SDK 1.4.2_10
    2. Tomcat 5.0.28
    3. Roller 2.0
    4. MySQL 5.0.16

    首先,确保MySQL开启了对InnoDB和UTF-8的支持,在my.ini中开启下面的参数:

    [mysqld]
    default-storage-engine=innodb
    default-character-set=utf8


    启动好MySQL待用...D:\MySQL\mysqld.exe --console --datadir=I:\MyData\Data

    假设我的Tomcat主目录为:$CATALINA_HOME=D:\J2EE_HOME\AppServer\Tomcat

    把压缩的Roller文件 roller-2.0-incubating.tar 解开...
    并放到
    $CATALINA_HOME\WebApp\roller下面...如图...



    开始建立MySQL中的数据库:
        I:> CD %CATALINA_HOME%\webapps\roller\WEB-INF\dbscripts\mysql
    I:> mysql -u root -p
    password: *****
    mysql> create database roller;
    mysql> grant all on roller.* to scott@'%' identified by 'tiger';
    mysql> grant all on roller.* to scott@'localhost' identified by 'tiger';
    mysql> use roller;
    mysql> source createdb.sql
    mysql> quit


    $CATALINA_HOME\conf\Catalina\localhost 中放置Roller的Web Application的部署
    配置档案 roller.xml,内容如下:

    <Context path="/roller" docBase="${catalina.home}/webapps/roller" debug="0">
    <Realm className="org.apache.catalina.realm.JDBCRealm"
    driverName="com.mysql.jdbc.Driver"
    connectionURL="jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"
    connectionName="scott"
    connectionPassword="tiger"
    userTable="rolleruser"
    userNameCol="username"
    userCredCol="passphrase"
    userRoleTable="userrole"
    roleNameCol="rolename" debug="0" />

    <Resource name="jdbc/rollerdb" auth="Container" type="javax.sql.DataSource" />
    <ResourceParams name="jdbc/rollerdb">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>scott</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>tiger</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>20</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>3</value>
    </parameter>
    <parameter>
    <name>removeAbandoned</name>
    <value>true</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>3000</value>
    </parameter>
    </ResourceParams>

    <!--//
    To enable email notification of comments: uncomment the resouce below,
    set your mailhost, and make sure you have mail.jar and activation.jar
    in <tomcat>/common/lib.
    //-->

    <!--//
    <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
    <ResourceParams name="mail/Session">
    <parameter>
    <name>mail.smtp.host</name>
        
            <value>mailhost.example.com</value>
            </parameter>
        </ResourceParams>
    //-->

    </Context>

    完成上面的设定后,接下来,我们修改一下Tomcat中的Connector的设定,使它能够支持UTF-8的编码,
    打开 $CATALINA_HOME\conf\server.xml,做如下修改...

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector port="80"
        URIEncoding="UTF-8"
        maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
        enableLookups="false" redirectPort="8443" acceptCount="100"
        debug="0" connectionTimeout="20000"
        disableUploadTimeout="true" />

    到这里,基本上Tomcat相关的设定就完成了,因为Roller Blog可以支持上传附件和全文检索等功能,
    所以,我们还有一个设定的动作...

    $CATALINA_HOME\WebApp\roller 中新建下面层次的目录:

     $CATALINA_HOME\WebApp\roller
                             |
                             +---data
                                   |
                                   +---search-index
                                   +---uploads

    找到 $CATALINA_HOME\webapps\roller\WEB-INF\classes\roller.properties  ,做如下修改:


    # The directory in which Roller will upload files
    # uploads.dir=${user.home}/roller_data/uploads
    uploads.dir=${TOMCAT_HOME}/webapps/roller/data/uploads

    # force Roller to recreate the entire search index)
    # search.index.dir=${user.home}/roller_data/search-index
    search.index.dir=${TOMCAT_HOME}/webapps/roller/data/search-index



    好了,大功告成,启动Tomcat,可以运行Roller了!

    antony
    :antony1029@163.com
    :http://antony1029.cnblogs.com
  • 相关阅读:
    2017/09/02笔记:ps
    207/08/3学习笔记:pc端网站如何实现移动端适配知识点
    2017/0828xueix笔记:图像替代文本&css绘制的图形
    20170824:面试题笔记
    目前比较全的CSS重设(reset)方法总结
    学习笔记:css3实现多行文字溢出显示省略号&display:box;
    SVG圆形<circle> 标签
    k8s节点分配nodeSelector, Affinity和Anti-Affinity 亲和性和反亲和性
    kubernetes网络介绍
    centos6.7 安装docker
  • 原文地址:https://www.cnblogs.com/antony1029/p/295842.html
Copyright © 2011-2022 走看看