xwiki系统安装配置说明书

Xwiki

 

 

 

2015-05-11

 

目录

1       系统安装要求... 2

2       服务器开通端口... 2

3       系统安装... 3

4       配置文件说明... 4

5       flamingo皮肤文件说明... 4

6       中文编码... 6

7       集群配置... 6

8       用户登陆... 8

8.1        Cookie的设置格式... 8

8.2        Cookie用户名和密码的加解密... 9

8.3        Validation的加密方式... 11

9       易信菜单配置... 12

 

 

1       系统安装要求

操作系统:windows7以上版本

Tomcat:tomcat6.0以上

Jdk:jdk1.7以上版本(不支持1.6版本)

数据库:mysql5.0以上

Xwiki软件:xwiki-enterprise-web-6.3-milestone-2以上版本,扩展包xwiki-enterprise-ui-wiki-all-6.3-milestone-2.xar

Office导入运行环境:Apache_OpenOffice_incubating_3.4.1_Win_x86_install_zh-CN.exe

2       服务器开通端口

14.31.15.50 服务器开通端口如下:

端口:8881
端口:8882
所有ip都可以访问


ftp服务
14.31.15.50 
端口21
所有ip都可以访问


下面的开通访问外网权限:

xwiki服务:

IP:91.121.34.179

对应域名:nexus.xwiki.org

端口:80



xwiki服务:

IP:5.135.240.206

对应域名:xwiki.org

端口:80



smtp.189.cn
25端口
服务器可以访问下列ip段:121.14.53.*

 

3       系统安装

3.1         安装jdk

见网上资料

3.2         安装tomcat

见网上资料

3.3         安装mysql

见网上资料

3.4         安装xwiki-enterprise-web-milestone

a)      直接解压后复制到tomcat的下面的webapp路径下

b)      Mysql新建xwiki或者其他名字的数据库。中文乱码的解决($TOMCAT_HOME/conf/server.xml该文件下Connector节中增加URIEncoding="UTF8")

c)      修改web-inf\hibernate.cfg.xml的连接方式为mysql(100行前后)

例如:

具体安装步骤及细节可以看网上

http://blog.csdn.net/lzwjavaphp/article/details/40185585

3.5         安装扩展包

xwiki-enterprise-web只是xwiki的一个基础的框架,里面没有具体的功能,需要安装xwiki-enterprise-ui-wiki-all-6.3-milestone-2.xar扩展包来丰富xwiki的功能。当然也可以引用其他的扩展包(其他的扩展包具体使用方法见使用说明文档)

3.6         安装office导入运行环境

直接运行安装程序Apache_OpenOffice_incubating_3.4.1_Win_x86_install_zh-CN.exe,如果默认路径,xwiki可以不用配置,若安装到其他路径需要修改web-inf/xwiki.properties中的openoffice.homePath路径,去掉“#”,并重启tomcat生效,具体的连接情况看使用说明书。

4       配置文件说明

4.1         Web-inf/Hibernate.cfg.xml

配置数据库连接等相关的参数,除了用到上述的数据库连接,其他基本没什么改动。

4.2         Web-inf/xwiki.cfg

xwiki.users.initialGroups=XWiki.XWikiAllGroup  新增用户默认所在的组,如果组命名有中文需要编码。

xwiki.db=hyzs_xwiki 数据库默认是xwiki,如果修改为其他名字这儿需要配置数据库的名字。

xwiki.superadminpassword=system123  超级用户的密码,账号:superadmin,如果初始的admin用户密码忘记后,可以使用该账号进行重置密码。

xwiki.authentication=form 权限验证方式,如果修改成basic后,上传附件或者图片需要再次登陆,尽量保留form方式。

xwiki.authentication.validationKey=totototototototototototototototo用户的账号加密时使用

xwiki.authentication.encryptionKey=titititititititititititititititi       解密时用。

xwiki.authentication.useip=false         用户ip参与鉴权,为true时如果用户更改ip后需要重新登陆。

xwiki.defaultskin=flamingo            默认皮肤

xwiki.authentication.cookielife=3650 配置文件中没有,需要新加,cookie的失效时间,默认是1天。

 

4.3         Web-inf/xwiki.properties

openoffice.homePath=/opt/openoffice.org3/  office导入插件的安装路径

observation.remote.channels = udp                       数据同步的方式。行业助手在同一个服务器上2个tomcat中间可以对缓存数据进行实时同步(有些数据不会实时更新到数据库)。

solr.embedded.home=/var/local/xwiki/solr 搜索引擎文件的默认路径,默认在tomcat的work/xwiki路径下。

5       flamingo皮肤文件说明

flamingo皮肤的文件单独存放在skins/flamingo文件夹下面:

attachmentsinline.vm页面下方列出所有的附件框架页面

attachmentslist.vm  页面下方列出所有的附件列表

colorThemeInit.vm

 

commentsinline.vm 显示评论

companylogo.vm 最左上角公司logo

contentview.vm详细内容展示模板

delete.vm 删除页面模板

docdoesnotexist.vm 文档不存在信息模板

docextra.vm文档下面论坛,附件,信息等框架

edit.vm  编辑页面

editactions.vm 编辑页面下面的动作,保存,取消等

editclass.vm编辑class页面

editinline.vm

editmeta.vm

editobject.vm 对象编辑页面

editwiki.vm 自动保存,全屏等功能

footer.vm  最底部信息

global.vm 每个页面可以包含的公共部分(上面导航条)

hierarchy.vm 显示层次结构,比如父目录,子目录有哪些

historyinline.vm 页面下方的历史列表

htmlheader.vm    框架头,设置左右面板

javascript.vm  javascript调用

layoutvars.vm管理模式下,空间的布局

login.vm登陆页面

macros.vm velocity自动加载

menus_content.vm  编辑按钮页面,导出,邮箱发送等功能

menus_create.vm  增加页面空间按钮

menus_home.vm    home按钮列表

menus_language.vm  语言选择按钮

menus_macros.vm   手机端或者浏览器变小上面导航条设置

menus_page.vm  

menus_space.vm导航条第二列按钮设置

menus_user.vm 导航条最右方用户按钮设置

menus_view.vm     页面上面导航条框架

menus_wiki.vm

preview.vm新增页面预览功能显示

previewactions.vm 预览页面上面的按钮(保存,取消等)

quicksearch.vm搜索框及按钮

renameStep1.vm 修改文档名字第一步

rightsUI.vm 权限页面的ui

shortcuts.vm

startpage.vm 框架的整体页面布局

view.vm    内容显示页面框架

6       中文编码

由于xwiki对中文的支持的翻译不是太完整,需要自己去修改中文配置文件。对应的配置文件在xwiki-platform-legacy-oldcore-6.3-milestone-2.jar包的ApplicationResources_zh.properties文件中修改,修改方式看里面的英文和中文的对应,但必须进行转码后才能更新到jar包中。

7       集群配置

Xwiki如果部署2个应用,存在数据存到内存中没及时更新到数据库的情况,需要配置2个应用端的数据同步,就需要配置集群功能,xwiki支持跨服务器的配置,由于当前2个应用部署到同一台服务器,就只研究同一台服务器的配置情况,具体的配置如下:

a)修改web-inf/xwiki.properties文件中:

observation.remote.enabled = true

observation.remote.channels = udp

 

b)创建udp.xml文件,内容如下:

<configxmlns="urn:org:jgroups"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="urn:org:jgroupshttp://www.jgroups.org/schema/JGroups-3.5.xsd">

 

   <UDP

        mcast_addr="${jgroups.udp.mcast_addr:235.5.5.5}"

        mcast_port="${jgroups.udp.mcast_port:45588}"

        tos="8"

        ucast_recv_buf_size="20M"

        ucast_send_buf_size="640K"

        mcast_recv_buf_size="25M"

        mcast_send_buf_size="640K"

        loopback="true"

        max_bundle_size="64K"

        max_bundle_timeout="30"

         ip_ttl="${jgroups.udp.ip_ttl:2}"

        enable_diagnostics="true"

        thread_naming_pattern="cl"

 

        timer_type="new"

        timer.min_threads="4"

        timer.max_threads="10"

        timer.keep_alive_time="3000"

        timer.queue_max_size="500"

 

        thread_pool.enabled="true"

        thread_pool.min_threads="2"

        thread_pool.max_threads="8"

        thread_pool.keep_alive_time="5000"

        thread_pool.queue_enabled="true"

        thread_pool.queue_max_size="10000"

        thread_pool.rejection_policy="discard"

 

        oob_thread_pool.enabled="true"

        oob_thread_pool.min_threads="1"

        oob_thread_pool.max_threads="8"

        oob_thread_pool.keep_alive_time="5000"

        oob_thread_pool.queue_enabled="false"

        oob_thread_pool.queue_max_size="100"

        oob_thread_pool.rejection_policy="Run"/>

 

   <PING timeout="2000" num_initial_members="3"/>

   <MERGE2 max_interval="30000"min_interval="10000"/>

   <FD_SOCK/>

   <FD_ALL/>

    <VERIFY_SUSPECTtimeout="1500"  />

   <BARRIER />

   <pbcast.NAKACK use_mcast_xmit="true"

                  retransmit_timeout="300,600,1200"

                  discard_delivered_msgs="true"/>

 

   <pbcast.STABLE stability_delay="1000"

                  desired_avg_gossip="50000"

                  max_bytes="4M"/>

   <pbcast.GMS print_local_addr="true"

               print_physical_addrs="true"

                join_timeout="3000"

                view_bundling="true"

                max_join_attempts="3"/>

               

   <UFC max_credits="2M" min_threshold="0.4"/>

   <MFC max_credits="2M" min_threshold="0.4"/>

   <FRAG2 frag_size="60K" />

   <pbcast.STATE_TRANSFER />

 

</config>

 

c)复制udp.xml文件到WEB-INF\observation\remote\jgroups文件夹下面

8       用户登陆

用户登陆是通过cookie设置的参数在有效期内免账号密码登陆,用户第一次访问时会记住相应的cookie参数。如果使用xwiki的登陆窗口登陆,有效期的时间见配置文件的参数设置。

8.1   Cookie的设置格式

123456登陆账号,猎豹保存的cookie

名字:

JSESSIONID

内容:

66BAC97D976AAD825F540E94DF5BE90F

域:

14.146.224.194

路径:

/xwiki

发送用途:

各种连接

脚本可访问:

创建时间:

2015330日星期一下午2:03:49

过期时间:

浏览会话结束时

 

 

名字:

password

内容:

"gyXtPST5rhA_"

域:

14.146.224.194

路径:

/

发送用途:

各种连接

脚本可访问:

否(仅 Http

创建时间:

2015330日星期一下午2:03:58

过期时间:

201546日星期一下午2:03:58

 

 

 

名字:

rememberme

内容:

"true"

域:

14.146.224.194

路径:

/

发送用途:

各种连接

脚本可访问:

否(仅 Http

创建时间:

2015330日星期一下午2:03:58

过期时间:

201546日星期一下午2:03:58

 

 

名字:

username

内容:

"gyXtPST5rhA_"

域:

14.146.224.194

路径:

/

发送用途:

各种连接

脚本可访问:

否(仅 Http

创建时间:

2015330日星期一下午2:03:58

过期时间:

201546日星期一下午2:03:58

 

 

名字:

validation

内容:

"b59701a79ea32c7a707519557966fc66"

域:

14.146.224.194

路径:

/

发送用途:

各种连接

脚本可访问:

否(仅 Http

创建时间:

2015330日星期一下午2:03:58

过期时间:

201546日星期一下午2:03:58

 

 

来源:

http://14.146.224.194:8181/

磁盘大小:

3.0 KB

最后修改日期:

2015330日星期一上午11:35:48

 

8.2   Cookie用户名和密码的加解密

importjava.security.Key;

 

importjavax.crypto.Cipher;

importjavax.crypto.spec.SecretKeySpec;

 

importorg.apache.commons.codec.binary.Base64;

 

 

publicclass test {

 

      /**

       *@param args

       */

      public static void main(String[] args) {

               // TODO Auto-generated methodstub

               Stringaa=decryptText("gyXtPST5rhA_");

               System.out.print(aa);

              

               Stringbb=encryptText("123456");

               System.out.print(bb);

              

      }

 

       private static String decryptText(String encryptedText)

         {

             try {

                 // Since the cookie spec does not allow = in the cookie value, it mustbe replaced

                 // with something else. Bas64 does not use _, and it is allowed incookies, so

                 // we're using that instead of =. In encryptText the reverse operationwas perfomed,

                 // so here we must re-introduce the = sign needed by Base64.

                 // See XWIKI-2211

                        String key = "titititi";

                          Key secretKey = newSecretKeySpec(key.getBytes(), "DES");

                 byte[] decodedEncryptedText =

                     Base64.decodeBase64(encryptedText.replaceAll("_","=").getBytes("ISO-8859-1"));

                 Cipher c1 = Cipher.getInstance("DES");

                 c1.init(Cipher.DECRYPT_MODE, secretKey);

                 byte[] decryptedText = c1.doFinal(decodedEncryptedText);

                 String decryptedTextString = new String(decryptedText);

                 return decryptedTextString;

             } catch (Exception e) {

                        e.toString();

                 return null;

             }

         }

       

       public static String encryptText(String clearText)

         {

             try {

                 Cipher c1 = Cipher.getInstance("DES");            

                String key = "titititi";

                Key secretKey = new SecretKeySpec(key.getBytes(), "DES");

                  if (secretKey != null) {

                      c1.init(Cipher.ENCRYPT_MODE,secretKey);

                      byte[] clearTextBytes;

                      clearTextBytes =clearText.getBytes();

                      byte[] encryptedText =c1.doFinal(clearTextBytes);

                      String encryptedEncodedText =new String(Base64.encodeBase64(encryptedText));

                      // Since the cookie spec doesnot allow = in the cookie value, it must be replaced

                      // with something else. Bas64does not use _, and it is allowed in cookies, so

                      // we're using that instead of=. In decryptText the reverse operation is perfomed.

                      // See XWIKI-2211

                      return encryptedEncodedText.replaceAll("=","_");

                 }

                

             } catch (Exception e) {

                        e.toString();

             }

             return null;

         }

}

8.3   Validation的加密方式

private static StringgenerateValidation(String eUsername, String ePassword) {

                   MessageDigestmd5 = null;

       StringBuffer sbValueBeforeMD5 = new StringBuffer();

 

       try {

           md5 = MessageDigest.getInstance("MD5");

 

           sbValueBeforeMD5.append(eUsername);

           sbValueBeforeMD5.append(":");

           sbValueBeforeMD5.append(ePassword);

           sbValueBeforeMD5.append(":");

           sbValueBeforeMD5.append("totototototototototototototototo");

 

           String valueBeforeMD5 = sbValueBeforeMD5.toString();

           md5.update(valueBeforeMD5.getBytes());

 

           byte[] array = md5.digest();

           StringBuffer sb = new StringBuffer();

           for (byte element : array) {

                int b = element & 0xFF;

                if (b < 0x10) {

                    sb.append('0');

                }

               sb.append(Integer.toHexString(b));

           }

           String valueAfterMD5 = sb.toString();

           return valueAfterMD5;

       } catch (Exception e) {

           e.printStackTrace();

           return null;

       }

         }

注意:

1.      如果部署多个xwiki应用,cookie的域必须是相同的,可以在配置文件里面配置,也可以是同一个服务器上的同一个ip地址。

2.      Cookie中的路径也最好是根目录,否则其他目录的应用没办法获取到cookie信息。

3.      Cookie的验证方式详细的情况需要查找源码。

 

9       易信菜单配置

由于需要判断用户是否登陆,通过一步跳转实现路径的导航。导航时由于xwiki的文档路径都是中文,存在中文编码的问题,需要通过url的2次转码才能显示正常(转码的链接http://tool.oschina.net/encode?type=4

 

转码前的内容为

{

   "button": [

       {

           "name": "一键搜索",

           "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8882/xw_front/index_wap.jsp",

           "type": "view",

           "key": null,

           "sub_button": null

       },

       {

           "name": "我的",

           "url": null,

           "type": null,

           "key": null,

           "sub_button": [

                   {

                    "name": "我要提问",

                    "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8881/mobilexwiki/bin/create/互动区/WebHome",

                    "type":"view",

                    "key": null,

                    "sub_button":null

                },

                {

                    "name": "我的参与",

                    "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8881/mobilexwiki/bin/view/互动区/我的提问",

                    "type":"view",

                    "key": null,

                    "sub_button":null

                },

                {

                    "name": "讨论区",

                    "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8881/mobilexwiki/bin/view/互动区/",

                    "type":"view",

                    "key": null,

                    "sub_button":null

                }

               

           ]

       },

       {

           "name": "最新资讯",

           "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8882/xw_front/MenuServlet?pageName=最新资讯",

           "type": "view",

           "key": null,

           "sub_button": null

       

       }

    ]

}

 

具体转码后的菜单内容:

{

   "button": [

       {

           "name": "一键搜索",

           "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8882/xw_front/index_wap.jsp",

           "type": "view",

           "key": null,

           "sub_button": null

       },

       {

           "name": "我的",

           "url": null,

           "type": null,

           "key": null,

           "sub_button": [

                   {

                    "name": "我要提问",

                    "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8881/mobilexwiki/bin/create/%25E4%25BA%2592%25E5%258A%25A8%25E5%258C%25BA/WebHome",

                    "type":"view",

                    "key": null,

                    "sub_button":null

                },

                {

                    "name": "我的参与",

                    "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8881/mobilexwiki/bin/view/%25E4%25BA%2592%25E5%258A%25A8%25E5%258C%25BA/%25E6%2588%2591%25E7%259A%2584%25E6%258F%2590%25E9%2597%25AE",

                    "type":"view",

                    "key": null,

                    "sub_button":null

                },

                {

                    "name": "讨论区",

                    "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8881/mobilexwiki/bin/view/%25E4%25BA%2592%25E5%258A%25A8%25E5%258C%25BA/",

                    "type":"view",

                    "key": null,

                   "sub_button": null

                }

               

           ]

       },

       {

           "name": "最新资讯",

           "url":"http://14.146.224.194:8882/xw_front/main?redirect_url=http://14.146.224.194:8882/xw_front/MenuServlet?pageName=%25E6%259C%2580%25E6%2596%25B0%25E8%25B5%2584%25E8%25AE%25AF",

           "type": "view",

           "key": null,

           "sub_button": null

       

       }

    ]

}

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值